UNPKG

@solid/community-server

Version:

Community Solid Server: an open and modular implementation of the Solid specifications

31 lines (30 loc) 1.52 kB
import type { PermissionMap } from '@solidlab/policy-engine'; import type { Credentials } from '../authentication/Credentials'; import type { AuthorizerInput } from './Authorizer'; import { Authorizer } from './Authorizer'; /** * Authorizer that bases its decision on the output it gets from its PermissionReader. * For each permission it checks if the reader allows that for at least one credential type, * if yes, authorization is granted. * `undefined` values for reader results are interpreted as `false`. */ export declare class PermissionBasedAuthorizer extends Authorizer { protected readonly logger: import("global-logger-factory").Logger<unknown>; handle(input: AuthorizerInput): Promise<void>; /** * Ensures that at least one of the credentials provides permissions for the given mode. * Throws a {@link ForbiddenHttpError} or {@link UnauthorizedHttpError} depending on the credentials * if access is not allowed. * * @param credentials - Credentials that require access. * @param permissionMap - PermissionMap describing the available permissions of the credentials. * @param mode - Which mode is requested. */ protected requireModePermission(credentials: Credentials, permissionMap: PermissionMap, mode: string): void; /** * Checks whether the agent is authenticated (logged in) or not (public/anonymous). * * @param credentials - Credentials to check. */ protected isAuthenticated(credentials: Credentials): boolean; }