mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
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:
@@ -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]: {}};
|
||||
}
|
||||
}
|
||||
12
src/authentication/PublicCredentialsExtractor.ts
Normal file
12
src/authentication/PublicCredentialsExtractor.ts
Normal 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]: {}};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user