-
Notifications
You must be signed in to change notification settings - Fork 121
/
Authorizer.ts
23 lines (22 loc) · 951 Bytes
/
Authorizer.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { Credentials } from '../authentication/Credentials';
import { PermissionSet } from '../ldp/permissions/PermissionSet';
import { ResourceIdentifier } from '../ldp/http/ResourceIdentifier';
/**
* Responsible for the permission verification.
*/
export interface Authorizer {
/**
* Verifies if the given credentials have access to the given permissions on the given resource.
* @param credentials - Credentials of the entity that wants to use the resource.
* @param identifier - Identifier of the resource that will be read/modified.
* @param permissions - Permissions that are requested on the resource.
*
* @returns A promise resolving when the Authorizer is finished.
* An {@link Error} with the necessary explanation will be thrown when permissions are not granted.
*/
ensurePermissions: (
credentials: Credentials,
identifier: ResourceIdentifier,
permissions: PermissionSet,
) => Promise<void>;
}