@adonisjs/auth
Version:
Official authentication provider for Adonis framework
45 lines (44 loc) • 1.48 kB
TypeScript
import { RedisManagerContract, RedisConnectionContract, RedisClusterConnectionContract } from '@ioc:Adonis/Addons/Redis';
import { TokenProviderContract, ProviderTokenContract, RedisTokenProviderConfig } from '@ioc:Adonis/Addons/Auth';
import { ProviderToken } from '../../Tokens/ProviderToken';
/**
* Redis backed tokens provider.
*/
export declare class TokenRedisProvider implements TokenProviderContract {
private config;
private redis;
constructor(config: RedisTokenProviderConfig, redis: RedisManagerContract);
/**
* Custom connection or query client
*/
private connection?;
/**
* Returns the singleton instance of the redis connection
*/
private getRedisConnection;
/**
* The foreign key column
*/
private foreignKey;
/**
* Parse the stringified redis token value to an object
*/
private parseToken;
/**
* Define custom connection
*/
setConnection(connection: string | RedisConnectionContract | RedisClusterConnectionContract): this;
/**
* Reads the token using the lookup token id
*/
read(tokenId: string, tokenHash: string, tokenType: string): Promise<ProviderTokenContract | null>;
/**
* Saves the token and returns the persisted token lookup id, which
* is a cuid.
*/
write(token: ProviderToken): Promise<string>;
/**
* Removes a given token
*/
destroy(tokenId: string, tokenType: string): Promise<void>;
}