mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-30 02:32:58 +05:30
Merge pull request #15 from elyby/issue_12
Replace commas with spaces in scopes list
This commit is contained in:
commit
7af08f3ed7
@ -10,7 +10,7 @@ export default class OAuthState extends AbstractState {
|
|||||||
redirectUrl: query.get('redirect_uri'),
|
redirectUrl: query.get('redirect_uri'),
|
||||||
responseType: query.get('response_type'),
|
responseType: query.get('response_type'),
|
||||||
description: query.get('description'),
|
description: query.get('description'),
|
||||||
scope: query.get('scope'),
|
scope: (query.get('scope') || '').replace(',', ' '),
|
||||||
prompt: query.get('prompt'),
|
prompt: query.get('prompt'),
|
||||||
loginHint: query.get('login_hint'),
|
loginHint: query.get('login_hint'),
|
||||||
state: query.get('state')
|
state: query.get('state')
|
||||||
|
@ -30,7 +30,7 @@ describe('OAuthState', () => {
|
|||||||
redirect_uri: 'redirect_uri',
|
redirect_uri: 'redirect_uri',
|
||||||
response_type: 'response_type',
|
response_type: 'response_type',
|
||||||
description: 'description',
|
description: 'description',
|
||||||
scope: 'scope',
|
scope: 'scope1 scope2',
|
||||||
prompt: 'none',
|
prompt: 'none',
|
||||||
login_hint: '1',
|
login_hint: '1',
|
||||||
state: 'state'
|
state: 'state'
|
||||||
@ -64,7 +64,7 @@ describe('OAuthState', () => {
|
|||||||
const query = {
|
const query = {
|
||||||
redirect_uri: 'redirect_uri',
|
redirect_uri: 'redirect_uri',
|
||||||
response_type: 'response_type',
|
response_type: 'response_type',
|
||||||
scope: 'scope',
|
scope: 'scope1 scope2',
|
||||||
state: 'state'
|
state: 'state'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ describe('OAuthState', () => {
|
|||||||
client_id: 'client_id',
|
client_id: 'client_id',
|
||||||
redirect_uri: 'redirect_uri',
|
redirect_uri: 'redirect_uri',
|
||||||
response_type: 'response_type',
|
response_type: 'response_type',
|
||||||
scope: 'scope',
|
scope: 'scope1 scope2',
|
||||||
state: 'state'
|
state: 'state'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -118,6 +118,34 @@ describe('OAuthState', () => {
|
|||||||
state.enter(context);
|
state.enter(context);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should replace commas with spaces in scope param', () => {
|
||||||
|
const query = {
|
||||||
|
client_id: 'client_id',
|
||||||
|
redirect_uri: 'redirect_uri',
|
||||||
|
response_type: 'response_type',
|
||||||
|
scope: 'scope1,scope2',
|
||||||
|
state: 'state',
|
||||||
|
};
|
||||||
|
|
||||||
|
context.getRequest.returns({
|
||||||
|
query: new URLSearchParams(query),
|
||||||
|
});
|
||||||
|
|
||||||
|
expectRun(
|
||||||
|
mock,
|
||||||
|
'oAuthValidate',
|
||||||
|
sinon.match({
|
||||||
|
clientId: query.client_id,
|
||||||
|
redirectUrl: query.redirect_uri,
|
||||||
|
responseType: query.response_type,
|
||||||
|
scope: 'scope1 scope2',
|
||||||
|
state: query.state,
|
||||||
|
})
|
||||||
|
).returns({then() {}});
|
||||||
|
|
||||||
|
state.enter(context);
|
||||||
|
});
|
||||||
|
|
||||||
it('should transition to complete state on success', () => {
|
it('should transition to complete state on success', () => {
|
||||||
const promise = Promise.resolve();
|
const promise = Promise.resolve();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user