From 448f8f2c116d474a5a3e486eda5bbde380ac9890 Mon Sep 17 00:00:00 2001 From: Livio Spring Date: Wed, 12 Jun 2024 08:42:50 +0200 Subject: [PATCH] fix(oauth2): correctly return an error on client_credentials and jwt_profile (#8092) # Which Problems Are Solved When an error occurred during the oidc session creation from client_credentials or jwt_profile, the error was ignored. # How the Problems Are Solved Return the error. # Additional Changes None. # Additional Context - relates to #7822 - noticed internally - backport to 2.53.x --- internal/api/oidc/token_client_credentials.go | 3 +++ internal/api/oidc/token_jwt_profile.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/internal/api/oidc/token_client_credentials.go b/internal/api/oidc/token_client_credentials.go index 4b3bf20acd..5d19e398a6 100644 --- a/internal/api/oidc/token_client_credentials.go +++ b/internal/api/oidc/token_client_credentials.go @@ -46,6 +46,9 @@ func (s *Server) ClientCredentialsExchange(ctx context.Context, r *op.ClientRequ nil, false, ) + if err != nil { + return nil, err + } return response(s.accessTokenResponseFromSession(ctx, client, session, "", "", false, true, false, false)) } diff --git a/internal/api/oidc/token_jwt_profile.go b/internal/api/oidc/token_jwt_profile.go index fc0c31a6eb..399fa5302e 100644 --- a/internal/api/oidc/token_jwt_profile.go +++ b/internal/api/oidc/token_jwt_profile.go @@ -54,6 +54,9 @@ func (s *Server) JWTProfile(ctx context.Context, r *op.Request[oidc.JWTProfileGr nil, false, ) + if err != nil { + return nil, err + } return response(s.accessTokenResponseFromSession(ctx, client, session, "", "", false, true, false, false)) }