2016-03-02 02:06:14 +05:30
|
|
|
import AbstractState from './AbstractState';
|
2020-01-18 02:07:52 +05:30
|
|
|
import { AuthContext } from './AuthFlow';
|
2016-03-02 02:06:14 +05:30
|
|
|
import CompleteState from './CompleteState';
|
|
|
|
|
|
|
|
export default class OAuthState extends AbstractState {
|
2020-05-24 04:38:24 +05:30
|
|
|
enter(context: AuthContext): Promise<void> | void {
|
|
|
|
const { query, params } = context.getRequest();
|
2016-03-02 02:06:14 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
return context
|
|
|
|
.run('oAuthValidate', {
|
|
|
|
clientId: query.get('client_id') || params.clientId,
|
2024-08-28 16:37:23 +05:30
|
|
|
redirectUrl: query.get('redirect_uri')!,
|
|
|
|
responseType: query.get('response_type')!,
|
|
|
|
description: query.get('description')!,
|
2020-05-24 04:38:24 +05:30
|
|
|
scope: (query.get('scope') || '').replace(/,/g, ' '),
|
2024-08-28 16:37:23 +05:30
|
|
|
prompt: query.get('prompt')!,
|
|
|
|
loginHint: query.get('login_hint')!,
|
|
|
|
state: query.get('state')!,
|
2020-05-24 04:38:24 +05:30
|
|
|
})
|
|
|
|
.then(() => context.setState(new CompleteState()));
|
|
|
|
}
|
2016-03-02 02:06:14 +05:30
|
|
|
}
|