backend-{plugin,app}-api: added addAuthPolicy to HttpRouterService + implementation

Co-authored-by: Fredrik Adelöw <freben@gmail.com>
Co-authored-by: Carl-Erik Bergström <cbergstrom@spotify.com>
Co-authored-by: blam <ben@blam.sh>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-02-09 13:04:48 +01:00
parent 746701e094
commit 344a82b4e5
7 changed files with 118 additions and 5 deletions
+10
View File
@@ -299,10 +299,20 @@ export interface HttpAuthService {
// @public (undocumented)
export interface HttpRouterService {
// (undocumented)
addAuthPolicy(policy: HttpRouterServiceAuthPolicy): void;
// (undocumented)
use(handler: Handler): void;
}
// @public (undocumented)
export interface HttpRouterServiceAuthPolicy {
// (undocumented)
allow: 'unauthenticated' | 'user-cookie';
// (undocumented)
path: string;
}
// @public (undocumented)
export interface IdentityService extends IdentityApi {}
@@ -16,9 +16,17 @@
import { Handler } from 'express';
/** @public */
export interface HttpRouterServiceAuthPolicy {
path: string;
allow: 'unauthenticated' | 'user-cookie';
}
/**
* @public
*/
export interface HttpRouterService {
use(handler: Handler): void;
addAuthPolicy(policy: HttpRouterServiceAuthPolicy): void;
}
@@ -29,7 +29,10 @@ export type {
export type { RootConfigService } from './RootConfigService';
export type { DatabaseService } from './DatabaseService';
export type { DiscoveryService } from './DiscoveryService';
export type { HttpRouterService } from './HttpRouterService';
export type {
HttpRouterService,
HttpRouterServiceAuthPolicy,
} from './HttpRouterService';
export type {
HttpAuthService,
BackstageCredentialTypes,