import { User } from '../user/types'; import { OAuth2Client, OAuth2Code, OAuth2Token } from './types'; export declare function getClientByClientId(clientId: string): Promise; export declare function validateSecret(oauth2Client: OAuth2Client, secret: string): Promise; export declare function validateRedirectUri(client: OAuth2Client, redirectUrl: string): Promise; /** * This function is used for the implicit grant oauth2 flow. * * This function creates an access token for a specific user. */ export declare function generateTokenForUser(client: OAuth2Client, user: User): Promise; /** * This function is used for the client_credentials oauth2 flow. * * In this flow there is not a 3rd party (resource owner). There is simply 2 * clients talk to each other. * * The client acts on behalf of itself, not someone else. */ export declare function generateTokenForClient(client: OAuth2Client): Promise; /** * This function is used for the authorization_code oauth2 flow. * * In this flow a user first authenticates itself and grants permisssion to * the client. After gaining permission the user gets redirected back to the * resource owner with a one-time code. * * The resource owner then exchanges that code for an access and refresh token. */ export declare function generateTokenFromCode(client: OAuth2Client, code: string): Promise; /** * This function is used for the authorization_code grant flow. * * This function creates an code for a user. The code is later exchanged for * a oauth2 access token. */ export declare function generateCodeForUser(client: OAuth2Client, user: User): Promise; /** * Returns Token information for an existing Access Token. * * This effectively gives you all information of an access token if you have * just the bearer, and allows you to validate if a bearer token is valid. * * This function will throw NotFound if the token was not recognized. */ export declare function getTokenByAccessToken(accessToken: string): Promise;