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-15 12:06:13 +05:30
|
|
|
import CompleteState from './CompleteState';
|
2016-03-02 02:06:14 +05:30
|
|
|
|
|
|
|
export default class PermissionsState extends AbstractState {
|
2020-05-24 04:38:24 +05:30
|
|
|
enter(context: AuthContext): Promise<void> | void {
|
|
|
|
context.navigate('/oauth/permissions', {
|
|
|
|
// replacing oauth entry point if currently on it
|
|
|
|
// to allow user easy go-back action to client's site
|
|
|
|
replace: context.getRequest().path.includes('oauth2'),
|
|
|
|
});
|
|
|
|
}
|
2016-03-02 02:06:14 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
resolve(context: AuthContext): Promise<void> | void {
|
2024-12-18 03:41:39 +05:30
|
|
|
return this.process(context, true);
|
2020-05-24 04:38:24 +05:30
|
|
|
}
|
2016-03-02 02:06:14 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
reject(context: AuthContext): void {
|
|
|
|
this.process(context, false);
|
|
|
|
}
|
2016-03-02 02:06:14 +05:30
|
|
|
|
2024-12-18 03:41:39 +05:30
|
|
|
process(context: AuthContext, accept: boolean): Promise<void> | void {
|
|
|
|
return context.setState(
|
2020-05-24 04:38:24 +05:30
|
|
|
new CompleteState({
|
|
|
|
accept,
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
2016-03-02 02:06:14 +05:30
|
|
|
}
|