|
|
|
@ -13,7 +13,6 @@ import { from, Observable, of, pipe } from 'rxjs'; |
|
|
|
import { filter, switchMap, tap } from 'rxjs/operators'; |
|
|
|
import { RestOccurError } from '../actions/rest.actions'; |
|
|
|
import { LoginParams } from '../models/auth'; |
|
|
|
import { AbpApplicationConfigurationService } from '../proxy/volo/abp/asp-net-core/mvc/application-configurations/abp-application-configuration.service'; |
|
|
|
import { ConfigStateService } from '../services/config-state.service'; |
|
|
|
import { EnvironmentService } from '../services/environment.service'; |
|
|
|
import { SessionStateService } from '../services/session-state.service'; |
|
|
|
@ -32,7 +31,6 @@ export abstract class AuthFlowStrategy { |
|
|
|
protected oAuthService: OAuthService; |
|
|
|
protected oAuthConfig: AuthConfig; |
|
|
|
protected sessionState: SessionStateService; |
|
|
|
protected appConfigService: AbpApplicationConfigurationService; |
|
|
|
protected tenantKey: string; |
|
|
|
|
|
|
|
abstract checkIfInternalAuth(queryParams?: Params): boolean; |
|
|
|
@ -47,7 +45,6 @@ export abstract class AuthFlowStrategy { |
|
|
|
this.environment = injector.get(EnvironmentService); |
|
|
|
this.configState = injector.get(ConfigStateService); |
|
|
|
this.oAuthService = injector.get(OAuthService); |
|
|
|
this.appConfigService = injector.get(AbpApplicationConfigurationService); |
|
|
|
this.sessionState = injector.get(SessionStateService); |
|
|
|
this.oAuthConfig = this.environment.getEnvironment().oAuthConfig; |
|
|
|
this.tenantKey = injector.get(TENANT_KEY); |
|
|
|
@ -84,11 +81,9 @@ export abstract class AuthFlowStrategy { |
|
|
|
.pipe( |
|
|
|
filter(event => event instanceof OAuthErrorEvent), |
|
|
|
tap(() => clearOAuthStorage()), |
|
|
|
switchMap(() => this.appConfigService.get()), |
|
|
|
switchMap(() => this.configState.refreshAppState()), |
|
|
|
) |
|
|
|
.subscribe(res => { |
|
|
|
this.configState.setState(res); |
|
|
|
}); |
|
|
|
.subscribe(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -148,9 +143,7 @@ export class AuthPasswordFlowStrategy extends AuthFlowStrategy { |
|
|
|
} else { |
|
|
|
this.oAuthService.logOut(); |
|
|
|
removeRememberMe(); |
|
|
|
this.appConfigService.get().subscribe(res => { |
|
|
|
this.configState.setState(res); |
|
|
|
}); |
|
|
|
this.configState.refreshAppState().subscribe(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
@ -188,9 +181,8 @@ export class AuthPasswordFlowStrategy extends AuthFlowStrategy { |
|
|
|
const router = this.injector.get(Router); |
|
|
|
|
|
|
|
return pipe( |
|
|
|
switchMap(() => this.appConfigService.get()), |
|
|
|
tap(res => { |
|
|
|
this.configState.setState(res); |
|
|
|
switchMap(() => this.configState.refreshAppState()), |
|
|
|
tap(() => { |
|
|
|
setRememberMe(params.rememberMe); |
|
|
|
if (params.redirectUrl) router.navigate([params.redirectUrl]); |
|
|
|
}), |
|
|
|
@ -201,9 +193,8 @@ export class AuthPasswordFlowStrategy extends AuthFlowStrategy { |
|
|
|
const router = this.injector.get(Router); |
|
|
|
|
|
|
|
return from(this.oAuthService.revokeTokenAndLogout(queryParams)).pipe( |
|
|
|
switchMap(() => this.appConfigService.get()), |
|
|
|
tap(res => { |
|
|
|
this.configState.setState(res); |
|
|
|
switchMap(() => this.configState.refreshAppState()), |
|
|
|
tap(() => { |
|
|
|
router.navigateByUrl('/'); |
|
|
|
removeRememberMe(); |
|
|
|
}), |
|
|
|
|