feat: allow overriding default ownership resolving

This allows to modify the ownership resolving in the auth resolve
context. For example if user wants to include parent groups also to
the ownershipEntityRefs, it's not possible unless the built-in
auth providers are forked and rewritten.

Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
This commit is contained in:
Heikki Hellgren
2024-02-06 15:21:22 +02:00
parent 16ef9e59e5
commit ea9262bc9f
11 changed files with 99 additions and 35 deletions
+1
View File
@@ -43,5 +43,6 @@ export type {
SignInInfo,
SignInResolver,
TokenParams,
AuthOwnershipResolver,
} from './types';
export { tokenTypes } from './types';
+9
View File
@@ -163,6 +163,15 @@ export type AuthResolverContext = {
): Promise<BackstageSignInResult>;
};
/**
* Resolver interface for resolving the ownership entity references for entity
*
* @public
*/
export interface AuthOwnershipResolver {
getOwnershipEntityRefs(entity: Entity): Promise<string[]>;
}
/**
* Any Auth provider needs to implement this interface which handles the routes in the
* auth backend. Any auth API requests from the frontend reaches these methods.