Skip to content

Commit

Permalink
feat: add eid-dk
Browse files Browse the repository at this point in the history
  • Loading branch information
hunger-programmer committed Sep 18, 2024
1 parent 2e9b133 commit 3541c83
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion __tests__/identity.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,19 @@ describe('Identity', () => {
}).toThrowError(new SDKError('The acrValues parameter is not acceptable: sms otp password youShallNoTPass'));
});

test('should accept variations of sms, otp, password, eid-no, eid-se, eid-fi, eid acrValues. Url shouldn\'t contain prompt=select_account', () => {
test('should accept variations of sms, otp, password, eid-dk, eid-no, eid-se, eid-fi, eid acrValues. Url shouldn\'t contain prompt=select_account', () => {
const identity = new Identity(Object.assign({}, defaultOptions, { env: 'PRO' }));

compareUrls(identity.loginUrl({
state: 'dummy-state',
acrValues: 'sms',
}), 'https://login.schibsted.com/oauth/authorize?redirect_uri=http%3A%2F%2Ffoo.com&client_id=foo&state=dummy-state&response_type=code&scope=openid&acr_values=sms');

compareUrls(identity.loginUrl({
state: 'dummy-state',
acrValues: 'eid-dk',
}), 'https://login.schibsted.com/oauth/authorize?redirect_uri=http%3A%2F%2Ffoo.com&client_id=foo&state=dummy-state&response_type=code&scope=openid&acr_values=eid-dk');

compareUrls(identity.loginUrl({
state: 'dummy-state',
acrValues: 'eid-no',
Expand Down
2 changes: 1 addition & 1 deletion src/identity.js
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ export class Identity extends EventEmitter {
teaser = arguments[6] || teaser;
maxAge = isNaN(arguments[7]) ? maxAge : arguments[7];
}
const isValidAcrValue = (acrValue) => isStrIn(acrValue, ['password', 'otp', 'sms', 'eid-no', 'eid-se', 'eid-fi', 'eid'], true);
const isValidAcrValue = (acrValue) => isStrIn(acrValue, ['password', 'otp', 'sms', 'eid-dk', 'eid-no', 'eid-se', 'eid-fi', 'eid'], true);
assert(!acrValues || isStrIn(acrValues, ['', 'otp-email'], true) || acrValues.split(' ').every(isValidAcrValue),
`The acrValues parameter is not acceptable: ${acrValues}`);
assert(isUrl(redirectUri),
Expand Down

0 comments on commit 3541c83

Please sign in to comment.