From 013e2770936464ff77e69b7850cebe246b5b545a Mon Sep 17 00:00:00 2001 From: Aozixuan Priscilla Guan <92183424+aoguan1990@users.noreply.github.com> Date: Fri, 24 Jun 2022 17:14:42 -0500 Subject: [PATCH] Fix OIDC looping issue - too many redriects (#1014) Signed-off-by: Aozixuan Priscilla Guan (cherry picked from commit 015dc3f0be7e835f7ea3763bd56e9c81845db344) --- server/auth/types/openid/routes.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/auth/types/openid/routes.ts b/server/auth/types/openid/routes.ts index 44e5220a6..8f17eae2b 100644 --- a/server/auth/types/openid/routes.ts +++ b/server/auth/types/openid/routes.ts @@ -178,8 +178,11 @@ export class OpenIdAuthRoutes { }); } catch (error) { context.security_plugin.logger.error(`OpenId authentication failed: ${error}`); - // redirect to login - return this.redirectToLogin(request, response); + if (error.toString().toLowerCase().includes('authentication exception')) { + return response.unauthorized(); + } else { + return this.redirectToLogin(request, response); + } } } );