Skip to content

Commit

Permalink
Run erlfmt with maybe Support
Browse files Browse the repository at this point in the history
  • Loading branch information
maennchen committed Oct 22, 2023
1 parent 89a37ca commit 90d9678
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
21 changes: 11 additions & 10 deletions src/oidcc_token.erl
Original file line number Diff line number Diff line change
Expand Up @@ -721,16 +721,18 @@ validate_id_token(IdToken, ClientContext, Nonce) ->
Bin when is_binary(Bin) ->
[{<<"nonce">>, Nonce} | ExpClaims0]
end,
JwksInclOct = case ClientSecret of
unauthenticated -> Jwks;
Secret ->
case oidcc_jwt_util:client_secret_oct_keys(AllowAlgorithms, Secret) of
none ->
JwksInclOct =
case ClientSecret of
unauthenticated ->
Jwks;
OctJwk ->
oidcc_jwt_util:merge_jwks(Jwks, OctJwk)
end
end,
Secret ->
case oidcc_jwt_util:client_secret_oct_keys(AllowAlgorithms, Secret) of
none ->
Jwks;
OctJwk ->
oidcc_jwt_util:merge_jwks(Jwks, OctJwk)
end
end,
{ok, {#jose_jwt{fields = Claims}, Jws}} ?=
oidcc_jwt_util:verify_signature(IdToken, AllowAlgorithms, JwksInclOct),
ok ?= oidcc_jwt_util:verify_claims(Claims, ExpClaims),
Expand Down Expand Up @@ -941,7 +943,6 @@ add_authentication(
) ->
NewHeader = [oidcc_http_util:basic_auth_header(ClientId, ClientSecret) | Header],
{ok, {QsBodyList, NewHeader}};

add_authentication(
QsBodyList,
Header,
Expand Down
19 changes: 11 additions & 8 deletions src/oidcc_userinfo.erl
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,18 @@ validate_userinfo_token(UserinfoToken, ClientContext, Opts) ->
} =
Configuration,
maybe
JwksInclOct = case ClientSecret of
unauthenticated -> Jwks;
Secret -> case oidcc_jwt_util:client_secret_oct_keys(AllowAlgorithms, Secret) of
none ->
JwksInclOct =
case ClientSecret of
unauthenticated ->
Jwks;
OctJwk ->
oidcc_jwt_util:merge_jwks(Jwks, OctJwk)
end
end,
Secret ->
case oidcc_jwt_util:client_secret_oct_keys(AllowAlgorithms, Secret) of
none ->
Jwks;
OctJwk ->
oidcc_jwt_util:merge_jwks(Jwks, OctJwk)
end
end,
{ok, {#jose_jwt{fields = Claims}, _Jws}} ?=
oidcc_jwt_util:verify_signature(UserinfoToken, AllowAlgorithms, JwksInclOct),
ok ?= oidcc_jwt_util:verify_claims(Claims, ExpClaims),
Expand Down

0 comments on commit 90d9678

Please sign in to comment.