Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new methods to abstract class and oauth.service.ts #18803

Merged
merged 2 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion npm/ng-packs/packages/core/src/lib/abstracts/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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 {
Expand All @@ -70,4 +90,12 @@ export interface IAuthService {
parameters: object,
headers?: HttpHeaders,
): Promise<AbpAuthResponse>;

getAccessTokenExpiration(): number;

getRefreshToken(): string;

getAccessToken(): string;

refreshToken(): Promise<AbpAuthResponse>;
}
16 changes: 16 additions & 0 deletions npm/ng-packs/packages/oauth/src/lib/services/oauth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Sinan997 marked this conversation as resolved.
Show resolved Hide resolved

getAccessTokenExpiration(): number {
return this.oAuthService.getAccessTokenExpiration();
}
}
Loading