mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-06 13:11:46 +00:00
oauth2-server: Fix lint (#20903)
This commit is contained in:
Vendored
+1
-84
@@ -14,18 +14,11 @@ declare class OAuth2Server {
|
||||
|
||||
/**
|
||||
* Instantiates OAuth2Server using the supplied model
|
||||
*
|
||||
* @param options
|
||||
*/
|
||||
constructor(options: OAuth2Server.ServerOptions);
|
||||
|
||||
/**
|
||||
* Authenticates a request.
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param options
|
||||
* @param callback
|
||||
*/
|
||||
authenticate(
|
||||
request: OAuth2Server.Request,
|
||||
@@ -36,11 +29,6 @@ declare class OAuth2Server {
|
||||
|
||||
/**
|
||||
* Authorizes a token request.
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param options
|
||||
* @param callback
|
||||
*/
|
||||
authorize(
|
||||
request: OAuth2Server.Request,
|
||||
@@ -51,11 +39,6 @@ declare class OAuth2Server {
|
||||
|
||||
/**
|
||||
* Retrieves a new token for an authorized token request.
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param options
|
||||
* @param callback
|
||||
*/
|
||||
token(
|
||||
request: OAuth2Server.Request,
|
||||
@@ -78,21 +61,18 @@ declare namespace OAuth2Server {
|
||||
/**
|
||||
* Instantiates Request using the supplied options.
|
||||
*
|
||||
* @param options
|
||||
*/
|
||||
constructor(options?: { [key: string]: any } | Express.Request);
|
||||
|
||||
/**
|
||||
* Returns the specified HTTP header field. The match is case-insensitive.
|
||||
*
|
||||
* @param field
|
||||
*/
|
||||
get(field: string): any | undefined;
|
||||
|
||||
/**
|
||||
* Checks if the request’s Content-Type HTTP header matches any of the given MIME types.
|
||||
*
|
||||
* @param types
|
||||
*/
|
||||
is(types: string[]): string | false;
|
||||
}
|
||||
@@ -108,29 +88,24 @@ declare namespace OAuth2Server {
|
||||
/**
|
||||
* Instantiates Response using the supplied options.
|
||||
*
|
||||
* @param options
|
||||
*/
|
||||
constructor(options?: { [key: string]: any; } | Express.Response);
|
||||
|
||||
/**
|
||||
* Returns the specified HTTP header field. The match is case-insensitive.
|
||||
*
|
||||
* @param field
|
||||
*/
|
||||
get(field: string): any | undefined;
|
||||
|
||||
/**
|
||||
* Sets the specified HTTP header field. The match is case-insensitive.
|
||||
*
|
||||
* @param field
|
||||
* @param value
|
||||
*/
|
||||
set(field: string, value: string): void;
|
||||
|
||||
/**
|
||||
* Redirects to the specified URL using 302 Found.
|
||||
*
|
||||
* @param url
|
||||
*/
|
||||
redirect(url: string): void;
|
||||
}
|
||||
@@ -146,7 +121,7 @@ declare namespace OAuth2Server {
|
||||
/**
|
||||
* The scope(s) to authenticate.
|
||||
*/
|
||||
scope?: string | undefined;
|
||||
scope?: string;
|
||||
|
||||
/**
|
||||
* Set the X-Accepted-OAuth-Scopes HTTP header on response objects.
|
||||
@@ -222,29 +197,18 @@ declare namespace OAuth2Server {
|
||||
/**
|
||||
* Invoked to generate a new access token.
|
||||
*
|
||||
* @param client
|
||||
* @param user
|
||||
* @param scope
|
||||
* @param callback
|
||||
*/
|
||||
generateAccessToken?(client: Client, user: User, scope: string, callback?: Callback<string>): Promise<string>;
|
||||
|
||||
/**
|
||||
* Invoked to retrieve a client using a client id or a client id/client secret combination, depending on the grant type.
|
||||
*
|
||||
* @param clientId
|
||||
* @param clientSecret
|
||||
* @param callback
|
||||
*/
|
||||
getClient(clientId: string, clientSecret: string, callback?: Callback<Client | Falsey>): Promise<Client | Falsey>;
|
||||
|
||||
/**
|
||||
* Invoked to save an access token and optionally a refresh token, depending on the grant type.
|
||||
*
|
||||
* @param token
|
||||
* @param client
|
||||
* @param user
|
||||
* @param callback
|
||||
*/
|
||||
saveToken(token: Token, client: Client, user: User, callback?: Callback<Token>): Promise<Token>;
|
||||
}
|
||||
@@ -253,17 +217,12 @@ declare namespace OAuth2Server {
|
||||
/**
|
||||
* Invoked to retrieve an existing access token previously saved through Model#saveToken().
|
||||
*
|
||||
* @param accessToken
|
||||
* @param callback
|
||||
*/
|
||||
getAccessToken(accessToken: string, callback?: Callback<Token>): Promise<Token>;
|
||||
|
||||
/**
|
||||
* Invoked during request authentication to check if the provided access token was authorized the requested scopes.
|
||||
*
|
||||
* @param token
|
||||
* @param scope
|
||||
* @param callback
|
||||
*/
|
||||
verifyScope(token: Token, scope: string, callback?: Callback<boolean>): Promise<boolean>;
|
||||
}
|
||||
@@ -272,53 +231,36 @@ declare namespace OAuth2Server {
|
||||
/**
|
||||
* Invoked to generate a new refresh token.
|
||||
*
|
||||
* @param client
|
||||
* @param user
|
||||
* @param scope
|
||||
* @param callback
|
||||
*/
|
||||
generateRefreshToken?(client: Client, user: User, scope: string, callback?: Callback<string>): Promise<string>;
|
||||
|
||||
/**
|
||||
* Invoked to generate a new authorization code.
|
||||
*
|
||||
* @param callback
|
||||
*/
|
||||
generateAuthorizationCode?(callback?: Callback<string>): Promise<string>;
|
||||
|
||||
/**
|
||||
* Invoked to retrieve an existing authorization code previously saved through Model#saveAuthorizationCode().
|
||||
*
|
||||
* @param authorizationCode
|
||||
* @param callback
|
||||
*/
|
||||
getAuthorizationCode(authorizationCode: string, callback?: Callback<AuthorizationCode>): Promise<AuthorizationCode>;
|
||||
|
||||
/**
|
||||
* Invoked to save an authorization code.
|
||||
*
|
||||
* @param code
|
||||
* @param client
|
||||
* @param user
|
||||
* @param callback
|
||||
*/
|
||||
saveAuthorizationCode(code: AuthorizationCode, client: Client, user: User, callback?: Callback<AuthorizationCode>): Promise<AuthorizationCode>;
|
||||
|
||||
/**
|
||||
* Invoked to revoke an authorization code.
|
||||
*
|
||||
* @param code
|
||||
* @param callback
|
||||
*/
|
||||
revokeAuthorizationCode(code: AuthorizationCode, callback?: Callback<boolean>): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Invoked to check if the requested scope is valid for a particular client/user combination.
|
||||
*
|
||||
* @param user
|
||||
* @param client
|
||||
* @param string
|
||||
* @param callback
|
||||
*/
|
||||
validateScope?(user: User, client: Client, scope: string, callback?: Callback<string[] | Falsey>): Promise<string[] | Falsey>;
|
||||
}
|
||||
@@ -327,29 +269,18 @@ declare namespace OAuth2Server {
|
||||
/**
|
||||
* Invoked to generate a new refresh token.
|
||||
*
|
||||
* @param client
|
||||
* @param user
|
||||
* @param scope
|
||||
* @param callback
|
||||
*/
|
||||
generateRefreshToken?(client: Client, user: User, scope: string, callback?: Callback<string>): Promise<string>;
|
||||
|
||||
/**
|
||||
* Invoked to retrieve a user using a username/password combination.
|
||||
*
|
||||
* @param username
|
||||
* @param password
|
||||
* @param callback
|
||||
*/
|
||||
getUser(username: string, password: string, callback?: Callback<User | Falsey>): Promise<User | Falsey>;
|
||||
|
||||
/**
|
||||
* Invoked to check if the requested scope is valid for a particular client/user combination.
|
||||
*
|
||||
* @param user
|
||||
* @param client
|
||||
* @param string
|
||||
* @param callback
|
||||
*/
|
||||
validateScope?(user: User, client: Client, scope: string, callback?: Callback<string[] | Falsey>): Promise<string[] | Falsey>;
|
||||
}
|
||||
@@ -358,26 +289,18 @@ declare namespace OAuth2Server {
|
||||
/**
|
||||
* Invoked to generate a new refresh token.
|
||||
*
|
||||
* @param client
|
||||
* @param user
|
||||
* @param scope
|
||||
* @param callback
|
||||
*/
|
||||
generateRefreshToken?(client: Client, user: User, scope: string, callback?: Callback<string>): Promise<string>;
|
||||
|
||||
/**
|
||||
* Invoked to retrieve an existing refresh token previously saved through Model#saveToken().
|
||||
*
|
||||
* @param refreshToken
|
||||
* @param callback
|
||||
*/
|
||||
getRefreshToken(refreshToken: string, callback?: Callback<RefreshToken>): Promise<RefreshToken>;
|
||||
|
||||
/**
|
||||
* Invoked to revoke a refresh token.
|
||||
*
|
||||
* @param token
|
||||
* @param callback
|
||||
*/
|
||||
revokeToken(token: Token, callback?: Callback<boolean>): Promise<boolean>;
|
||||
}
|
||||
@@ -386,18 +309,12 @@ declare namespace OAuth2Server {
|
||||
/**
|
||||
* Invoked to retrieve the user associated with the specified client.
|
||||
*
|
||||
* @param client
|
||||
* @param callback
|
||||
*/
|
||||
getUserFromClient(client: Client, callback?: Callback<User | Falsey>): Promise<User | Falsey>;
|
||||
|
||||
/**
|
||||
* Invoked to check if the requested scope is valid for a particular client/user combination.
|
||||
*
|
||||
* @param user
|
||||
* @param client
|
||||
* @param string
|
||||
* @param callback
|
||||
*/
|
||||
validateScope?(user: User, client: Client, scope: string, callback?: Callback<string[] | Falsey>): Promise<string[] | Falsey>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user