Browse Source
Merge pull request #8052 from abpframework/auto-merge/rel-4-2/178
Merge branch dev with rel-4.2
pull/8057/head
Mehmet Erim
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
14 additions and
2 deletions
-
npm/ng-packs/packages/core/src/lib/strategies/auth-flow.strategy.ts
|
|
|
@ -58,10 +58,14 @@ export abstract class AuthFlowStrategy { |
|
|
|
return Promise.resolve(); |
|
|
|
} |
|
|
|
|
|
|
|
return this.oAuthService.refreshToken() as Promise<any>; |
|
|
|
return this.refreshToken(); |
|
|
|
}) |
|
|
|
.catch(this.catchError); |
|
|
|
} |
|
|
|
|
|
|
|
protected refreshToken() { |
|
|
|
return this.oAuthService.refreshToken().catch(() => clearOAuthStorage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export class AuthCodeFlowStrategy extends AuthFlowStrategy { |
|
|
|
@ -111,9 +115,10 @@ export class AuthPasswordFlowStrategy extends AuthFlowStrategy { |
|
|
|
) |
|
|
|
.subscribe(() => { |
|
|
|
if (this.oAuthService.getRefreshToken()) { |
|
|
|
this.oAuthService.refreshToken(); |
|
|
|
this.refreshToken(); |
|
|
|
} else { |
|
|
|
this.oAuthService.logOut(); |
|
|
|
this.removeRememberMe(); |
|
|
|
this.appConfigService.get().subscribe(res => { |
|
|
|
this.configState.setState(res); |
|
|
|
}); |
|
|
|
@ -184,6 +189,13 @@ export class AuthPasswordFlowStrategy extends AuthFlowStrategy { |
|
|
|
}), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
protected refreshToken() { |
|
|
|
return this.oAuthService.refreshToken().catch(() => { |
|
|
|
clearOAuthStorage(); |
|
|
|
this.removeRememberMe(); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export const AUTH_FLOW_STRATEGY = { |
|
|
|
|