feat: Support acl authorization for IDP components

Configuration has been updated so the IDP requests
also pass through an Authorization component.
A new config option was added to choose
which authorization scheme to use for the IDP.
This commit is contained in:
Joachim Van Herwegen
2021-09-27 09:13:27 +02:00
parent 9968f2ae5b
commit 13c49045d4
44 changed files with 401 additions and 75 deletions

View File

@@ -1,21 +0,0 @@
import type { HttpRequest } from '../server/HttpRequest';
import { NotImplementedHttpError } from '../util/errors/NotImplementedHttpError';
import { CredentialGroup } from './Credentials';
import type { CredentialSet } from './Credentials';
import { CredentialsExtractor } from './CredentialsExtractor';
/**
* Extracts the empty credentials, indicating an unauthenticated agent.
*/
export class EmptyCredentialsExtractor extends CredentialsExtractor {
public async canHandle({ headers }: HttpRequest): Promise<void> {
const { authorization } = headers;
if (authorization) {
throw new NotImplementedHttpError('Unexpected Authorization scheme.');
}
}
public async handle(): Promise<CredentialSet> {
return { [CredentialGroup.public]: {}};
}
}

View File

@@ -0,0 +1,12 @@
import { CredentialGroup } from './Credentials';
import type { CredentialSet } from './Credentials';
import { CredentialsExtractor } from './CredentialsExtractor';
/**
* Extracts the public credentials, to be used for data everyone has access to.
*/
export class PublicCredentialsExtractor extends CredentialsExtractor {
public async handle(): Promise<CredentialSet> {
return { [CredentialGroup.public]: {}};
}
}