UNPKG

@citrineos/util

Version:

The OCPP util module which supplies helpful utilities like cache and queue connectors, etc.

35 lines (34 loc) 1.32 kB
import type { FastifyRequest } from 'fastify'; import type { ILogObj } from 'tslog'; import { Logger } from 'tslog'; import type { IApiAuthProvider, UserInfo } from '@citrineos/base'; import { ApiAuthenticationResult, ApiAuthorizationResult } from '@citrineos/base'; /** * A local bypass authentication provider that doesn't perform actual authentication * Only for development and testing environments */ export declare class LocalBypassAuthProvider implements IApiAuthProvider { private readonly _logger; /** * Creates a new local bypass authentication provider * * @param logger Optional logger instance */ constructor(logger?: Logger<ILogObj>); extractToken(_request: FastifyRequest): Promise<string>; /** * Always returns a successful authentication with admin user * * @param token Ignored, can be any string * @returns Authentication result with admin user info */ authenticateToken(_token: string): Promise<ApiAuthenticationResult>; /** * Always returns a successful authorization * * @param user Ignored, can be any user * @param request Ignored, can be any request * @returns Always successful authorization */ authorizeUser(user: UserInfo, request: FastifyRequest): Promise<ApiAuthorizationResult>; }