BTBurke / caddy-jwt

JWT middleware for the Caddy server
MIT License
114 stars 39 forks source link

Optionally secure paths based on claims #1

Closed BTBurke closed 8 years ago

BTBurke commented 8 years ago

Allow a path to be secured based on the value of a validated claim.

Proposed Caddyfile format:

To authorize a path only for a certain claim value:

jwt [path] {
   allow <claim> <value>
}

To authorize any validated token except for a certain claim value:

jwt [path] {
   deny <claim> <value>
}

For example, to authorize a path only for a token with

{
"role": "admin"
}
jwt /protected_admin_stuff {
    allow role admin
}