Merge pull request #7534 from akrantz01/6284/okta-https-audience

Require https audience for Okta authentication
This commit is contained in:
Patrik Oldsberg
2021-10-20 18:50:57 +02:00
committed by GitHub
2 changed files with 12 additions and 0 deletions
@@ -275,6 +275,13 @@ export const createOktaProvider = (
const audience = envConfig.getString('audience');
const callbackUrl = `${globalConfig.baseUrl}/${providerId}/handler/frame`;
// This is a safe assumption as `passport-okta-oauth` uses the audience
// as the base for building the authorization, token, and user info URLs.
// https://github.com/fischerdan/passport-okta-oauth/blob/ea9ac42d/lib/passport-okta-oauth/oauth2.js#L12-L14
if (!audience.startsWith('https://')) {
throw new Error("URL for 'audience' must start with 'https://'.");
}
const catalogIdentityClient = new CatalogIdentityClient({
catalogApi,
tokenIssuer,