Files
CommunitySolidServer/src/authorization/PermissionReader.ts
Wouter Termont 86f45923ba feat: Add index signature to Credentials
* 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>
2023-11-10 08:10:10 +01:00

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> {}