Skip to content

Commit

Permalink
auth-backend: throw error if OIDC IdP does not have a userinfo endpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
  • Loading branch information
Rugvip committed Sep 10, 2021
1 parent 977710c commit de57178
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/polite-dragons-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage/plugin-auth-backend': patch
---

Use a more informative error message if the configured OIDC identity provider does not provide a `userinfo_endpoint` in its metadata.
5 changes: 5 additions & 0 deletions plugins/auth-backend/src/providers/oidc/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ export class OidcAuthProvider implements OAuthHandlers {
userinfo: UserinfoResponse,
done: PassportDoneCallback<AuthResult, PrivateInfo>,
) => {
if (typeof done !== 'function') {
throw new Error(
'OIDC IdP must provide a userinfo_endpoint in the metadata response',
);
}
done(
undefined,
{ tokenset, userinfo },
Expand Down

0 comments on commit de57178

Please sign in to comment.