Browse Source
Merge pull request #18983 from abpframework/issue-16631
Fix bug while setting value to RememberMeService and enhancement for IAuthService interface
pull/18994/head
Masum ULU
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
26 additions and
1 deletions
-
npm/ng-packs/packages/core/src/lib/abstracts/auth.service.ts
-
npm/ng-packs/packages/oauth/src/lib/services/oauth.service.ts
-
npm/ng-packs/packages/oauth/src/lib/utils/auth-utils.ts
|
|
|
@ -16,6 +16,15 @@ export class AuthService implements IAuthService { |
|
|
|
console.error('You should add @abp/ng-oauth packages or create your own auth packages.'); |
|
|
|
} |
|
|
|
|
|
|
|
get oidc(): boolean { |
|
|
|
this.warningMessage(); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
set oidc(value: boolean) { |
|
|
|
this.warningMessage(); |
|
|
|
} |
|
|
|
|
|
|
|
init(): Promise<any> { |
|
|
|
this.warningMessage(); |
|
|
|
return Promise.resolve(undefined); |
|
|
|
@ -73,6 +82,8 @@ export class AuthService implements IAuthService { |
|
|
|
} |
|
|
|
|
|
|
|
export interface IAuthService { |
|
|
|
oidc: boolean; |
|
|
|
|
|
|
|
get isInternalAuth(): boolean; |
|
|
|
|
|
|
|
get isAuthenticated(): boolean; |
|
|
|
|
|
|
|
@ -16,6 +16,14 @@ export class AbpOAuthService implements IAuthService { |
|
|
|
private strategy!: AuthFlowStrategy; |
|
|
|
private readonly oAuthService: OAuthService; |
|
|
|
|
|
|
|
get oidc() { |
|
|
|
return this.oAuthService.oidc; |
|
|
|
} |
|
|
|
|
|
|
|
set oidc(value) { |
|
|
|
this.oAuthService.oidc = value; |
|
|
|
} |
|
|
|
|
|
|
|
get isInternalAuth() { |
|
|
|
return this.strategy.isInternalAuth; |
|
|
|
} |
|
|
|
|
|
|
|
@ -3,6 +3,7 @@ import { Router } from '@angular/router'; |
|
|
|
import { pipe } from 'rxjs'; |
|
|
|
import { switchMap, tap } from 'rxjs/operators'; |
|
|
|
import { |
|
|
|
AuthService, |
|
|
|
ConfigStateService, |
|
|
|
LoginParams, |
|
|
|
PipeToLoginFn, |
|
|
|
@ -16,10 +17,15 @@ export const pipeToLogin: PipeToLoginFn = function ( |
|
|
|
const configState = injector.get(ConfigStateService); |
|
|
|
const router = injector.get(Router); |
|
|
|
const rememberMeService = injector.get(RememberMeService); |
|
|
|
const authService = injector.get(AuthService); |
|
|
|
return pipe( |
|
|
|
switchMap(() => configState.refreshAppState()), |
|
|
|
tap(() => { |
|
|
|
rememberMeService.set(params.rememberMe); |
|
|
|
rememberMeService.set( |
|
|
|
params.rememberMe || |
|
|
|
rememberMeService.get() || |
|
|
|
rememberMeService.getFromToken(authService.getAccessToken()) |
|
|
|
); |
|
|
|
if (params.redirectUrl) router.navigate([params.redirectUrl]); |
|
|
|
}), |
|
|
|
); |
|
|
|
|