Browse Source
Merge pull request #18803 from abpframework/enhancement/auth.service
Add new methods to abstract class and oauth.service.ts
pull/18814/head
Gizem Mutu Kurt
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
45 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
|
|
|
@ -31,7 +31,7 @@ export class AuthService implements IAuthService { |
|
|
|
return of(undefined); |
|
|
|
} |
|
|
|
|
|
|
|
navigateToLogin(queryParams?: Params): void {} |
|
|
|
navigateToLogin(queryParams?: Params): void { } |
|
|
|
|
|
|
|
get isInternalAuth(): boolean { |
|
|
|
throw new Error('not implemented'); |
|
|
|
@ -50,6 +50,26 @@ export class AuthService implements IAuthService { |
|
|
|
console.log({ grantType, parameters, headers }); |
|
|
|
return Promise.reject(new Error('not implemented')); |
|
|
|
} |
|
|
|
|
|
|
|
getAccessTokenExpiration(): number { |
|
|
|
this.warningMessage(); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
getRefreshToken(): string { |
|
|
|
this.warningMessage(); |
|
|
|
return ''; |
|
|
|
} |
|
|
|
|
|
|
|
getAccessToken(): string { |
|
|
|
this.warningMessage(); |
|
|
|
return ''; |
|
|
|
} |
|
|
|
|
|
|
|
refreshToken(): Promise<AbpAuthResponse> { |
|
|
|
this.warningMessage(); |
|
|
|
return Promise.resolve(undefined); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
export interface IAuthService { |
|
|
|
@ -70,4 +90,12 @@ export interface IAuthService { |
|
|
|
parameters: object, |
|
|
|
headers?: HttpHeaders, |
|
|
|
): Promise<AbpAuthResponse>; |
|
|
|
|
|
|
|
getAccessTokenExpiration(): number; |
|
|
|
|
|
|
|
getRefreshToken(): string; |
|
|
|
|
|
|
|
getAccessToken(): string; |
|
|
|
|
|
|
|
refreshToken(): Promise<AbpAuthResponse>; |
|
|
|
} |
|
|
|
|
|
|
|
@ -83,4 +83,20 @@ export class AbpOAuthService implements IAuthService { |
|
|
|
|
|
|
|
return this.oAuthService.fetchTokenUsingGrant(grantType, p, headers); |
|
|
|
} |
|
|
|
|
|
|
|
getRefreshToken(): string { |
|
|
|
return this.oAuthService.getRefreshToken(); |
|
|
|
} |
|
|
|
|
|
|
|
getAccessToken(): string { |
|
|
|
return this.oAuthService.getAccessToken(); |
|
|
|
} |
|
|
|
|
|
|
|
refreshToken(): Promise<AbpAuthResponse> { |
|
|
|
return this.oAuthService.refreshToken(); |
|
|
|
} |
|
|
|
|
|
|
|
getAccessTokenExpiration(): number { |
|
|
|
return this.oAuthService.getAccessTokenExpiration(); |
|
|
|
} |
|
|
|
} |
|
|
|
|