Skip to content

Commit

Permalink
Fix OIDC looping issue - too many redriects (opensearch-project#1014)
Browse files Browse the repository at this point in the history
Signed-off-by: Aozixuan Priscilla Guan <[email protected]>
Signed-off-by: Vasile Negru <[email protected]>
  • Loading branch information
aoguan1990 authored and Vasile Negru committed Aug 8, 2022
1 parent 40478f5 commit 08092a4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/auth/types/openid/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
);
Expand Down

0 comments on commit 08092a4

Please sign in to comment.