Skip to content

Commit

Permalink
Merge pull request #5057 from apache/jwt-exp-by-default
Browse files Browse the repository at this point in the history
JWT: require valid `exp` claim by default
  • Loading branch information
rnewson committed May 16, 2024
2 parents 7e5e0ac + 3aa3f1d commit f9e0eed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion rel/overlay/etc/default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ bind_address = 127.0.0.1
; List of claims to validate
; can be the name of a claim like "exp" or a tuple if the claim requires
; a parameter
;required_claims = exp, {iss, "IssuerNameHere"}
; Example:
; required_claims = exp, nbf, {iss, "MyCompany"}
; default value if not set;
;required_claims = exp

; roles_claim_name is marked as deprecated. Please use roles_claim_path instead!
; Values for ``roles_claim_name`` can only be top-level attributes in the JWT
Expand Down
2 changes: 1 addition & 1 deletion src/couch/src/couch_httpd_auth.erl
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ get_roles_claim(Claims) ->
end.

get_configured_claims() ->
Claims = config:get("jwt_auth", "required_claims", ""),
Claims = config:get("jwt_auth", "required_claims", "exp"),
Re = "((?<key1>[a-z]+)|{(?<key2>[a-z]+)\s*,\s*\"(?<val>[^\"]+)\"})",
case re:run(Claims, Re, [global, {capture, [key1, key2, val], binary}]) of
nomatch when Claims /= "" ->
Expand Down

0 comments on commit f9e0eed

Please sign in to comment.