CommunitySolidServer/src/authorization/SimpleAuthorizer.ts
2020-07-23 08:52:44 +02:00

18 lines
582 B
TypeScript

import { UnsupportedHttpError } from '../util/errors/UnsupportedHttpError';
import { Authorizer, AuthorizerArgs } from './Authorizer';
/**
* Authorizer which allows all access independent of the identifier and requested permissions.
*/
export class SimpleAuthorizer extends Authorizer {
public async canHandle(input: AuthorizerArgs): Promise<void> {
if (!input.identifier || !input.permissions) {
throw new UnsupportedHttpError('Authorizer requires an identifier and permissions.');
}
}
public async handle(): Promise<void> {
// Allows all actions
}
}