auth-backend: throw error if OIDC IdP does not have a userinfo endpoint

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-09-10 16:15:26 +02:00
parent 977710cf3c
commit de5717872d
2 changed files with 10 additions and 0 deletions
+5
View File
@@ -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.
@@ -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 },