Overriding Functions
#
Main interface- Express
- Hapi
- Fastify
- Koa
- Loopback
- AWS Lambda / Netlify
- Next.js
- NestJS
interface RecipeInterface { /* * Called when you want to create a new session for the given userId. * The default implementation will set the relevant session headers. * * @params: res is the response object * userId (string value) * jwtPayload and sessionData are optional * * @returns: See the type definition below */ createNewSession(input: { res: Express.Response; userId: string; jwtPayload?: any; sessionData?: any; }): Promise<SessionContainerInterface>;
/* * Checks whether an active session is present for the request or not * * @params: req is the request object * res is the response object * verifySessionOptions will contain two boolean values: to enable/disable * anti-csrf check and another to state if session requirement is optional * * @returns: SessionContainerInterface if active session is present, * else undefined */ getSession(input: { req: Express.Request; res: Express.Response; options?: VerifySessionOptions; }): Promise<SessionContainerInterface | undefined>;
/* * Called to refresh a session. * * @params: req is the request object * res is the response object * * @returns: See the type definition below */ refreshSession(input: { req: Express.Request; res: Express.Response }): Promise<SessionContainerInterface>;
/* * Called to revoke all the existing sessions for the users * * @params: userId (string value) * * @returns: All the revoked session handles */ revokeAllSessionsForUser(input: { userId: string }): Promise<string[]>;
/* * Called get all session handles for a user * * @params: userId (string value) * * @returns: All the session handles */ getAllSessionHandlesForUser(input: { userId: string }): Promise<string[]>;
/* * Called when you want to logout a user and end a session * * @params: sessionHandle related to the session you want to revoke * * @returns: true if session was revoked, else false */ revokeSession(input: { sessionHandle: string }): Promise<boolean>;
/* * Called when you want to revoke multiple user sessions using session handles * * @params: sessionHandles related to the sessions you want to revoke * * @returns: All the revoked session handles */ revokeMultipleSessions(input: { sessionHandles: string[] }): Promise<string[]>;
/* * Called to get session data associated with a given session handle * * @params: sessionHandle * * @returns: session data associated with the session handle */ getSessionData(input: { sessionHandle: string }): Promise<any>;
/* * Called to update the session data associated with a given session handle * * @params: sessionHandle * newSessionData */ updateSessionData(input: { sessionHandle: string; newSessionData: any }): Promise<void>;
/* * Called to get jwt data associated with a given session handle * * @params: sessionHandle * * @returns: jwt data associated with the session handle */ getJWTPayload(input: { sessionHandle: string }): Promise<any>;
/* * Called to update the jwt data associated with a given session handle * * @params: sessionHandle * newJWTPayload */ updateJWTPayload(input: { sessionHandle: string; newJWTPayload: any }): Promise<void>;
/* * Called to get access token life time in milli-seconds(ms). */ getAccessTokenLifeTimeMS(): Promise<number>;
/* * Called to get refresh token life time in milli-seconds(ms). */ getRefreshTokenLifeTimeMS(): Promise<number>;}
interface RecipeInterface { /* * Called when you want to create a new session for the given userId. * The default implementation will set the relevant session headers. * * @params: res is the response object * userId (string value) * jwtPayload and sessionData are optional * * @returns: See the type definition below */ createNewSession(input: { res: Hapi.ResponseToolkit; userId: string; jwtPayload?: any; sessionData?: any; }): Promise<SessionContainerInterface>;
/* * Checks whether an active session is present for the request or not * * @params: req is the request object * res is the response object * verifySessionOptions will contain two boolean values: to enable/disable * anti-csrf check and another to state if session requirement is optional * * @returns: SessionContainerInterface if active session is present, * else undefined */ getSession(input: { req: Hapi.Request; res: Hapi.ResponseToolkit; options?: VerifySessionOptions; }): Promise<SessionContainerInterface | undefined>;
/* * Called to refresh a session. * * @params: req is the request object * res is the response object * * @returns: See the type definition below */ refreshSession(input: { req: Hapi.Request; res: Hapi.ResponseToolkit }): Promise<SessionContainerInterface>;
/* * Called to revoke all the existing sessions for the users * * @params: userId (string value) * * @returns: All the revoked session handles */ revokeAllSessionsForUser(input: { userId: string }): Promise<string[]>;
/* * Called get all session handles for a user * * @params: userId (string value) * * @returns: All the session handles */ getAllSessionHandlesForUser(input: { userId: string }): Promise<string[]>;
/* * Called when you want to logout a user and end a session * * @params: sessionHandle related to the session you want to revoke * * @returns: true if session was revoked, else false */ revokeSession(input: { sessionHandle: string }): Promise<boolean>;
/* * Called when you want to revoke multiple user sessions using session handles * * @params: sessionHandles related to the sessions you want to revoke * * @returns: All the revoked session handles */ revokeMultipleSessions(input: { sessionHandles: string[] }): Promise<string[]>;
/* * Called to get session data associated with a given session handle * * @params: sessionHandle * * @returns: session data associated with the session handle */ getSessionData(input: { sessionHandle: string }): Promise<any>;
/* * Called to update the session data associated with a given session handle * * @params: sessionHandle * newSessionData */ updateSessionData(input: { sessionHandle: string; newSessionData: any }): Promise<void>;
/* * Called to get jwt data associated with a given session handle * * @params: sessionHandle * * @returns: jwt data associated with the session handle */ getJWTPayload(input: { sessionHandle: string }): Promise<any>;
/* * Called to update the jwt data associated with a given session handle * * @params: sessionHandle * newJWTPayload */ updateJWTPayload(input: { sessionHandle: string; newJWTPayload: any }): Promise<void>;
/* * Called to get access token life time in milli-seconds(ms). */ getAccessTokenLifeTimeMS(): Promise<number>;
/* * Called to get refresh token life time in milli-seconds(ms). */ getRefreshTokenLifeTimeMS(): Promise<number>;}
interface RecipeInterface { /* * Called when you want to create a new session for the given userId. * The default implementation will set the relevant session headers. * * @params: res is the response object * userId (string value) * jwtPayload and sessionData are optional * * @returns: See the type definition below */ createNewSession(input: { res: Fastify.FastifyReply; userId: string; jwtPayload?: any; sessionData?: any; }): Promise<SessionContainerInterface>;
/* * Checks whether an active session is present for the request or not * * @params: req is the request object * res is the response object * verifySessionOptions will contain two boolean values: to enable/disable * anti-csrf check and another to state if session requirement is optional * * @returns: SessionContainerInterface if active session is present, * else undefined */ getSession(input: { req: Fastify.FastifyRequest; res: Fastify.FastifyReply; options?: VerifySessionOptions; }): Promise<SessionContainerInterface | undefined>;
/* * Called to retrieve all session related information for a given session handle * * @params: sessionHandle * * @returns SessionInformation if a session for the given sessionHandle exists * * @throws If a session does not exist */ getSessionInformation(input: { sessionHandle: string }): Promise<SessionInformation>;
/* * Called to refresh a session. * * @params: req is the request object * res is the response object * * @returns: See the type definition below */ refreshSession(input: { req: Fastify.FastifyRequest; res: Fastify.FastifyReply }): Promise<SessionContainerInterface>;
/* * Called to revoke all the existing sessions for the users * * @params: userId (string value) * * @returns: All the revoked session handles */ revokeAllSessionsForUser(input: { userId: string }): Promise<string[]>;
/* * Called get all session handles for a user * * @params: userId (string value) * * @returns: All the session handles */ getAllSessionHandlesForUser(input: { userId: string }): Promise<string[]>;
/* * Called when you want to logout a user and end a session * * @params: sessionHandle related to the session you want to revoke * * @returns: true if session was revoked, else false */ revokeSession(input: { sessionHandle: string }): Promise<boolean>;
/* * Called when you want to revoke multiple user sessions using session handles * * @params: sessionHandles related to the sessions you want to revoke * * @returns: All the revoked session handles */ revokeMultipleSessions(input: { sessionHandles: string[] }): Promise<string[]>;
/* * @deprecated Use getSessionInformation() instead * * Called to get session data associated with a given session handle * * @params: sessionHandle * * @returns: session data associated with the session handle */ getSessionData(input: { sessionHandle: string }): Promise<any>;
/* * Called to update the session data associated with a given session handle * * @params: sessionHandle * newSessionData */ updateSessionData(input: { sessionHandle: string; newSessionData: any }): Promise<void>;
/* * @deprecated Use getSessionInformation() instead * * Called to get jwt data associated with a given session handle * * @params: sessionHandle * * @returns: jwt data associated with the session handle */ getJWTPayload(input: { sessionHandle: string }): Promise<any>;
/* * Called to update the jwt data associated with a given session handle * * @params: sessionHandle * newJWTPayload */ updateJWTPayload(input: { sessionHandle: string; newJWTPayload: any }): Promise<void>;
/* * Called to get access token life time in milli-seconds(ms). */ getAccessTokenLifeTimeMS(): Promise<number>;
/* * Called to get refresh token life time in milli-seconds(ms). */ getRefreshTokenLifeTimeMS(): Promise<number>;}
interface RecipeInterface { /* * Called when you want to create a new session for the given userId. * The default implementation will set the relevant session headers. * * @params: res is the response object * userId (string value) * jwtPayload and sessionData are optional * * @returns: See the type definition below */ createNewSession(input: { res: AWS.APIGatewayProxyEvent | AWS.APIGatewayProxyEventV2; userId: string; jwtPayload?: any; sessionData?: any; }): Promise<SessionContainerInterface>;
/* * Checks whether an active session is present for the request or not * * @params: req is the request object * res is the response object * verifySessionOptions will contain two boolean values: to enable/disable * anti-csrf check and another to state if session requirement is optional * * @returns: SessionContainerInterface if active session is present, * else undefined */ getSession(input: { req: AWS.APIGatewayProxyEvent | AWS.APIGatewayProxyEventV2; res: AWS.APIGatewayProxyEvent | AWS.APIGatewayProxyEventV2; options?: VerifySessionOptions; }): Promise<SessionContainerInterface | undefined>;
/* * Called to refresh a session. * * @params: req is the request object * res is the response object * * @returns: See the type definition below */ refreshSession(input: { req: AWS.APIGatewayProxyEvent | AWS.APIGatewayProxyEventV2; res: AWS.APIGatewayProxyEvent | AWS.APIGatewayProxyEventV2 }): Promise<SessionContainerInterface>;
/* * Called to revoke all the existing sessions for the users * * @params: userId (string value) * * @returns: All the revoked session handles */ revokeAllSessionsForUser(input: { userId: string }): Promise<string[]>;
/* * Called get all session handles for a user * * @params: userId (string value) * * @returns: All the session handles */ getAllSessionHandlesForUser(input: { userId: string }): Promise<string[]>;
/* * Called when you want to logout a user and end a session * * @params: sessionHandle related to the session you want to revoke * * @returns: true if session was revoked, else false */ revokeSession(input: { sessionHandle: string }): Promise<boolean>;
/* * Called when you want to revoke multiple user sessions using session handles * * @params: sessionHandles related to the sessions you want to revoke * * @returns: All the revoked session handles */ revokeMultipleSessions(input: { sessionHandles: string[] }): Promise<string[]>;
/* * Called to get session data associated with a given session handle * * @params: sessionHandle * * @returns: session data associated with the session handle */ getSessionData(input: { sessionHandle: string }): Promise<any>;
/* * Called to update the session data associated with a given session handle * * @params: sessionHandle * newSessionData */ updateSessionData(input: { sessionHandle: string; newSessionData: any }): Promise<void>;
/* * Called to get jwt data associated with a given session handle * * @params: sessionHandle * * @returns: jwt data associated with the session handle */ getJWTPayload(input: { sessionHandle: string }): Promise<any>;
/* * Called to update the jwt data associated with a given session handle * * @params: sessionHandle * newJWTPayload */ updateJWTPayload(input: { sessionHandle: string; newJWTPayload: any }): Promise<void>;
/* * Called to get access token life time in milli-seconds(ms). */ getAccessTokenLifeTimeMS(): Promise<number>;
/* * Called to get refresh token life time in milli-seconds(ms). */ getRefreshTokenLifeTimeMS(): Promise<number>;}
interface RecipeInterface { /* * Called when you want to create a new session for the given userId. * The default implementation will set the relevant session headers. * * @params: res is the response object * userId (string value) * jwtPayload and sessionData are optional * * @returns: See the type definition below */ createNewSession(input: { res: Koa.Context; userId: string; jwtPayload?: any; sessionData?: any; }): Promise<SessionContainerInterface>;
/* * Checks whether an active session is present for the request or not * * @params: req is the request object * res is the response object * verifySessionOptions will contain two boolean values: to enable/disable * anti-csrf check and another to state if session requirement is optional * * @returns: SessionContainerInterface if active session is present, * else undefined */ getSession(input: { req: Koa.Context; res: Koa.Context; options?: VerifySessionOptions; }): Promise<SessionContainerInterface | undefined>;
/* * Called to refresh a session. * * @params: req is the request object * res is the response object * * @returns: See the type definition below */ refreshSession(input: { req: Koa.Context; res: Koa.Context }): Promise<SessionContainerInterface>;
/* * Called to revoke all the existing sessions for the users * * @params: userId (string value) * * @returns: All the revoked session handles */ revokeAllSessionsForUser(input: { userId: string }): Promise<string[]>;
/* * Called get all session handles for a user * * @params: userId (string value) * * @returns: All the session handles */ getAllSessionHandlesForUser(input: { userId: string }): Promise<string[]>;
/* * Called when you want to logout a user and end a session * * @params: sessionHandle related to the session you want to revoke * * @returns: true if session was revoked, else false */ revokeSession(input: { sessionHandle: string }): Promise<boolean>;
/* * Called when you want to revoke multiple user sessions using session handles * * @params: sessionHandles related to the sessions you want to revoke * * @returns: All the revoked session handles */ revokeMultipleSessions(input: { sessionHandles: string[] }): Promise<string[]>;
/* * Called to get session data associated with a given session handle * * @params: sessionHandle * * @returns: session data associated with the session handle */ getSessionData(input: { sessionHandle: string }): Promise<any>;
/* * Called to update the session data associated with a given session handle * * @params: sessionHandle * newSessionData */ updateSessionData(input: { sessionHandle: string; newSessionData: any }): Promise<void>;
/* * Called to get jwt data associated with a given session handle * * @params: sessionHandle * * @returns: jwt data associated with the session handle */ getJWTPayload(input: { sessionHandle: string }): Promise<any>;
/* * Called to update the jwt data associated with a given session handle * * @params: sessionHandle * newJWTPayload */ updateJWTPayload(input: { sessionHandle: string; newJWTPayload: any }): Promise<void>;
/* * Called to get access token life time in milli-seconds(ms). */ getAccessTokenLifeTimeMS(): Promise<number>;
/* * Called to get refresh token life time in milli-seconds(ms). */ getRefreshTokenLifeTimeMS(): Promise<number>;}
interface RecipeInterface { /* * Called when you want to create a new session for the given userId. * The default implementation will set the relevant session headers. * * @params: res is the response object * userId (string value) * jwtPayload and sessionData are optional * * @returns: See the type definition below */ createNewSession(input: { res: Loopback.MiddlewareContext; userId: string; jwtPayload?: any; sessionData?: any; }): Promise<SessionContainerInterface>;
/* * Checks whether an active session is present for the request or not * * @params: req is the request object * res is the response object * verifySessionOptions will contain two boolean values: to enable/disable * anti-csrf check and another to state if session requirement is optional * * @returns: SessionContainerInterface if active session is present, * else undefined */ getSession(input: { req: Loopback.MiddlewareContext; res: Loopback.MiddlewareContext; options?: VerifySessionOptions; }): Promise<SessionContainerInterface | undefined>;
/* * Called to refresh a session. * * @params: req is the request object * res is the response object * * @returns: See the type definition below */ refreshSession(input: { req: Loopback.MiddlewareContext; res: Loopback.MiddlewareContext }): Promise<SessionContainerInterface>;
/* * Called to revoke all the existing sessions for the users * * @params: userId (string value) * * @returns: All the revoked session handles */ revokeAllSessionsForUser(input: { userId: string }): Promise<string[]>;
/* * Called get all session handles for a user * * @params: userId (string value) * * @returns: All the session handles */ getAllSessionHandlesForUser(input: { userId: string }): Promise<string[]>;
/* * Called when you want to logout a user and end a session * * @params: sessionHandle related to the session you want to revoke * * @returns: true if session was revoked, else false */ revokeSession(input: { sessionHandle: string }): Promise<boolean>;
/* * Called when you want to revoke multiple user sessions using session handles * * @params: sessionHandles related to the sessions you want to revoke * * @returns: All the revoked session handles */ revokeMultipleSessions(input: { sessionHandles: string[] }): Promise<string[]>;
/* * Called to get session data associated with a given session handle * * @params: sessionHandle * * @returns: session data associated with the session handle */ getSessionData(input: { sessionHandle: string }): Promise<any>;
/* * Called to update the session data associated with a given session handle * * @params: sessionHandle * newSessionData */ updateSessionData(input: { sessionHandle: string; newSessionData: any }): Promise<void>;
/* * Called to get jwt data associated with a given session handle * * @params: sessionHandle * * @returns: jwt data associated with the session handle */ getJWTPayload(input: { sessionHandle: string }): Promise<any>;
/* * Called to update the jwt data associated with a given session handle * * @params: sessionHandle * newJWTPayload */ updateJWTPayload(input: { sessionHandle: string; newJWTPayload: any }): Promise<void>;
/* * Called to get access token life time in milli-seconds(ms). */ getAccessTokenLifeTimeMS(): Promise<number>;
/* * Called to get refresh token life time in milli-seconds(ms). */ getRefreshTokenLifeTimeMS(): Promise<number>;}
interface RecipeInterface { /* * Called when you want to create a new session for the given userId. * The default implementation will set the relevant session headers. * * @params: res is the response object * userId (string value) * jwtPayload and sessionData are optional * * @returns: See the type definition below */ createNewSession(input: { res: Next.NextApiResponse; userId: string; jwtPayload?: any; sessionData?: any; }): Promise<SessionContainerInterface>;
/* * Checks whether an active session is present for the request or not * * @params: req is the request object * res is the response object * verifySessionOptions will contain two boolean values: to enable/disable * anti-csrf check and another to state if session requirement is optional * * @returns: SessionContainerInterface if active session is present, * else undefined */ getSession(input: { req: Next.NextApiRequest; res: Next.NextApiResponse; options?: VerifySessionOptions; }): Promise<SessionContainerInterface | undefined>;
/* * Called to refresh a session. * * @params: req is the request object * res is the response object * * @returns: See the type definition below */ refreshSession(input: { req: Next.NextApiRequest; res: Next.NextApiResponse }): Promise<SessionContainerInterface>;
/* * Called to revoke all the existing sessions for the users * * @params: userId (string value) * * @returns: All the revoked session handles */ revokeAllSessionsForUser(input: { userId: string }): Promise<string[]>;
/* * Called get all session handles for a user * * @params: userId (string value) * * @returns: All the session handles */ getAllSessionHandlesForUser(input: { userId: string }): Promise<string[]>;
/* * Called when you want to logout a user and end a session * * @params: sessionHandle related to the session you want to revoke * * @returns: true if session was revoked, else false */ revokeSession(input: { sessionHandle: string }): Promise<boolean>;
/* * Called when you want to revoke multiple user sessions using session handles * * @params: sessionHandles related to the sessions you want to revoke * * @returns: All the revoked session handles */ revokeMultipleSessions(input: { sessionHandles: string[] }): Promise<string[]>;
/* * Called to get session data associated with a given session handle * * @params: sessionHandle * * @returns: session data associated with the session handle */ getSessionData(input: { sessionHandle: string }): Promise<any>;
/* * Called to update the session data associated with a given session handle * * @params: sessionHandle * newSessionData */ updateSessionData(input: { sessionHandle: string; newSessionData: any }): Promise<void>;
/* * Called to get jwt data associated with a given session handle * * @params: sessionHandle * * @returns: jwt data associated with the session handle */ getJWTPayload(input: { sessionHandle: string }): Promise<any>;
/* * Called to update the jwt data associated with a given session handle * * @params: sessionHandle * newJWTPayload */ updateJWTPayload(input: { sessionHandle: string; newJWTPayload: any }): Promise<void>;
/* * Called to get access token life time in milli-seconds(ms). */ getAccessTokenLifeTimeMS(): Promise<number>;
/* * Called to get refresh token life time in milli-seconds(ms). */ getRefreshTokenLifeTimeMS(): Promise<number>;}
// NestJS uses library-specific types for Request and Response// You should use the one provided by your underlying framework (the default is Express)
interface RecipeInterface { /* * Called when you want to create a new session for the given userId. * The default implementation will set the relevant session headers. * * @params: res is the response object * userId (string value) * jwtPayload and sessionData are optional * * @returns: See the type definition below */ createNewSession(input: { res: Express.Response; userId: string; jwtPayload?: any; sessionData?: any; }): Promise<SessionContainerInterface>;
/* * Checks whether an active session is present for the request or not * * @params: req is the request object * res is the response object * verifySessionOptions will contain two boolean values: to enable/disable * anti-csrf check and another to state if session requirement is optional * * @returns: SessionContainerInterface if active session is present, * else undefined */ getSession(input: { req: Express.Request; res: Express.Response; options?: VerifySessionOptions; }): Promise<SessionContainerInterface | undefined>;
/* * Called to refresh a session. * * @params: req is the request object * res is the response object * * @returns: See the type definition below */ refreshSession(input: { req: Express.Request; res: Express.Response }): Promise<SessionContainerInterface>;
/* * Called to revoke all the existing sessions for the users * * @params: userId (string value) * * @returns: All the revoked session handles */ revokeAllSessionsForUser(input: { userId: string }): Promise<string[]>;
/* * Called get all session handles for a user * * @params: userId (string value) * * @returns: All the session handles */ getAllSessionHandlesForUser(input: { userId: string }): Promise<string[]>;
/* * Called when you want to logout a user and end a session * * @params: sessionHandle related to the session you want to revoke * * @returns: true if session was revoked, else false */ revokeSession(input: { sessionHandle: string }): Promise<boolean>;
/* * Called when you want to revoke multiple user sessions using session handles * * @params: sessionHandles related to the sessions you want to revoke * * @returns: All the revoked session handles */ revokeMultipleSessions(input: { sessionHandles: string[] }): Promise<string[]>;
/* * Called to get session data associated with a given session handle * * @params: sessionHandle * * @returns: session data associated with the session handle */ getSessionData(input: { sessionHandle: string }): Promise<any>;
/* * Called to update the session data associated with a given session handle * * @params: sessionHandle * newSessionData */ updateSessionData(input: { sessionHandle: string; newSessionData: any }): Promise<void>;
/* * Called to get jwt data associated with a given session handle * * @params: sessionHandle * * @returns: jwt data associated with the session handle */ getJWTPayload(input: { sessionHandle: string }): Promise<any>;
/* * Called to update the jwt data associated with a given session handle * * @params: sessionHandle * newJWTPayload */ updateJWTPayload(input: { sessionHandle: string; newJWTPayload: any }): Promise<void>;
/* * Called to get access token life time in milli-seconds(ms). */ getAccessTokenLifeTimeMS(): Promise<number>;
/* * Called to get refresh token life time in milli-seconds(ms). */ getRefreshTokenLifeTimeMS(): Promise<number>;}
interface SessionContainerInterface { revokeSession(): Promise<void>;
getSessionData(): Promise<any>;
updateSessionData(newSessionData: any): Promise<any>;
getUserId(): string;
getJWTPayload(): any;
getHandle(): string;
getAccessToken(): string;
updateJWTPayload(newJWTPayload: any): Promise<void>;}
interface VerifySessionOptions { antiCsrfCheck?: boolean; sessionRequired?: boolean;}