@amirmarmul/waba-common
Version:

33 lines (32 loc) • 893 B
TypeScript
import Authenticable from './Authenticable';
import Guard from './Guard';
import UserProvider from './UserProvider';
export declare class TokenGuard implements Guard {
/**
* The request instance.
*/
private _req;
/**
* The user provider implementation.
*/
private _provider;
/**
* The currently authenticated user.
*/
private _user;
/**
* Create a new authtentication guard.
*/
constructor(provider: UserProvider, req: any);
/**
* Determine if the current user is authenticated. If not, throw an error.
*/
authenticate(): Promise<Authenticable>;
check(): Promise<boolean>;
guest(): Promise<boolean>;
setUser(user: Authenticable): Promise<void>;
setRequest(req: any): Promise<void>;
user(): Promise<Authenticable | null>;
private getTokenFromRequest;
}
export default TokenGuard;