@defra/lis-hubs-infra-access 0.3.0-lreg-177.alpha.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/auth/oidc.js +9 -1
package/package.json
CHANGED
package/src/auth/oidc.js
CHANGED
|
@@ -99,6 +99,14 @@ function createCodeExchanger({
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
function resolveScope(configuredScope) {
|
|
103
|
+
const requestedScopes = (configuredScope ?? 'openid').split(' ')
|
|
104
|
+
|
|
105
|
+
return requestedScopes.includes('openid')
|
|
106
|
+
? requestedScopes.join(' ')
|
|
107
|
+
: ['openid', ...requestedScopes].join(' ')
|
|
108
|
+
}
|
|
109
|
+
|
|
102
110
|
function addAuthorizationParameters(
|
|
103
111
|
authorizationUrl,
|
|
104
112
|
{ providerConfig, redirectUri, authFlow }
|
|
@@ -106,7 +114,7 @@ function addAuthorizationParameters(
|
|
|
106
114
|
const parameters = {
|
|
107
115
|
client_id: providerConfig.clientId,
|
|
108
116
|
response_type: 'code',
|
|
109
|
-
scope: providerConfig.scope
|
|
117
|
+
scope: resolveScope(providerConfig.scope),
|
|
110
118
|
redirect_uri: redirectUri,
|
|
111
119
|
state: authFlow.state,
|
|
112
120
|
nonce: authFlow.nonce,
|