mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
* feat: abstract Credentials type for Authorizer * feat: abstract Credentials type in CredentialsExtractor & PermissionReader * chore: typegraphical corrections in documentation Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com> * fix: remove accidental .js extension * feat: also check for undefined credentials when deciding 401/404 * docs: corrections to code documentation Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com> * fix: revert abstraction & index signature to Credentials * chhore: fix linter issues --------- Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
23 lines
920 B
TypeScript
23 lines
920 B
TypeScript
import type { Credentials } from '../authentication/Credentials';
|
|
import { AsyncHandler } from '../util/handlers/AsyncHandler';
|
|
import type { AccessMap, PermissionMap } from './permissions/Permissions';
|
|
|
|
export interface PermissionReaderInput {
|
|
/**
|
|
* Credentials of the entity requesting access to resources.
|
|
*/
|
|
credentials: Credentials;
|
|
/**
|
|
* For each credential, the reader will check which of the given per-resource access modes are available.
|
|
* However, non-exhaustive information about other access modes and resources can still be returned.
|
|
*/
|
|
requestedModes: AccessMap;
|
|
}
|
|
|
|
/**
|
|
* Discovers the permissions of the given credentials on the given identifier.
|
|
* If the reader finds no permission for the requested identifiers and credentials,
|
|
* it can return an empty or incomplete map.
|
|
*/
|
|
export abstract class PermissionReader extends AsyncHandler<PermissionReaderInput, PermissionMap> {}
|