Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add eid-dk #287

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading