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

feat(authentication): extend TokenService for revokeable tokens #4746

Merged
merged 1 commit into from
Mar 11, 2020
Merged
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
18 changes: 18 additions & 0 deletions packages/authentication/src/services/token.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,28 @@ import {UserProfile} from '@loopback/security';
export interface TokenService {
/**
* Verifies the validity of a token string and returns a user profile
*
* @param token The token/secret which should be validated/verified.
*
* @returns The UserProfile which belongs to the given token.
*/
verifyToken(token: string): Promise<UserProfile>;

/**
* Generates a token string based on a user profile
*
* @param userProfile A UserProfile for which a token should be generated.
*
* @returns a generated token/secret for a given UserProfile.
*/
generateToken(userProfile: UserProfile): Promise<string>;

/**
* Revokes a given token (if supported by token system)
*
* @param token The token/secret which should be revoked/invalidated.
*
* @returns true, if the given token was invalidated.
*/
revokeToken?(token: string): Promise<boolean>;
}