From 90d96786f609b443da87f9fddbe9138093dc17a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20M=C3=A4nnchen?= Date: Sun, 22 Oct 2023 12:38:25 +0200 Subject: [PATCH] Run erlfmt with maybe Support --- src/oidcc_token.erl | 21 +++++++++++---------- src/oidcc_userinfo.erl | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/oidcc_token.erl b/src/oidcc_token.erl index 37a7459..f00b4e5 100644 --- a/src/oidcc_token.erl +++ b/src/oidcc_token.erl @@ -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), @@ -941,7 +943,6 @@ add_authentication( ) -> NewHeader = [oidcc_http_util:basic_auth_header(ClientId, ClientSecret) | Header], {ok, {QsBodyList, NewHeader}}; - add_authentication( QsBodyList, Header, diff --git a/src/oidcc_userinfo.erl b/src/oidcc_userinfo.erl index 012daa6..0269685 100644 --- a/src/oidcc_userinfo.erl +++ b/src/oidcc_userinfo.erl @@ -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),