auth refactor type fixes
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -21,4 +21,4 @@ export {
|
||||
type IdentityClientOptions,
|
||||
} from './DefaultIdentityClient';
|
||||
export { IdentityClient } from './IdentityClient';
|
||||
export type { IdentityApi } from './IdentityApi';
|
||||
export type { IdentityApi, IdentityApiGetIdentityRequest } from './IdentityApi';
|
||||
|
||||
@@ -40,6 +40,5 @@ export {
|
||||
type OAuthAuthenticatorRefreshInput,
|
||||
type OAuthAuthenticatorResult,
|
||||
type OAuthAuthenticatorStartInput,
|
||||
type OAuthProfileTransform,
|
||||
type OAuthSession,
|
||||
} from './types';
|
||||
|
||||
@@ -18,6 +18,7 @@ import { Config } from '@backstage/config';
|
||||
import { Request } from 'express';
|
||||
import { ProfileTransform } from '../types';
|
||||
|
||||
/** @public */
|
||||
export interface OAuthSession {
|
||||
accessToken: string;
|
||||
tokenType: string;
|
||||
@@ -27,33 +28,39 @@ export interface OAuthSession {
|
||||
refreshToken?: string;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface OAuthAuthenticatorStartInput {
|
||||
scope: string;
|
||||
state: string;
|
||||
req: Request;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface OAuthAuthenticatorAuthenticateInput {
|
||||
req: Request;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface OAuthAuthenticatorRefreshInput {
|
||||
scope: string;
|
||||
refreshToken: string;
|
||||
req: Request;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface OAuthAuthenticatorLogoutInput {
|
||||
accessToken?: string;
|
||||
refreshToken?: string;
|
||||
req: Request;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface OAuthAuthenticatorResult<TProfile> {
|
||||
fullProfile: TProfile;
|
||||
session: OAuthSession;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface OAuthAuthenticator<TContext, TProfile> {
|
||||
defaultProfileTransform: ProfileTransform<OAuthAuthenticatorResult<TProfile>>;
|
||||
shouldPersistScopes?: boolean;
|
||||
@@ -73,6 +80,7 @@ export interface OAuthAuthenticator<TContext, TProfile> {
|
||||
logout?(input: OAuthAuthenticatorLogoutInput, ctx: TContext): Promise<void>;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export function createOAuthAuthenticator<TContext, TProfile>(
|
||||
authenticator: OAuthAuthenticator<TContext, TProfile>,
|
||||
): OAuthAuthenticator<TContext, TProfile> {
|
||||
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
import { createProxyAuthRouteHandlers } from './createProxyRouteHandlers';
|
||||
import { ProxyAuthenticator } from './types';
|
||||
|
||||
/** @public */
|
||||
export function createProxyAuthProviderFactory<TResult>(options: {
|
||||
authenticator: ProxyAuthenticator<unknown, TResult>;
|
||||
profileTransform?: ProfileTransform<TResult>;
|
||||
|
||||
@@ -18,6 +18,7 @@ import { Config } from '@backstage/config';
|
||||
import { Request } from 'express';
|
||||
import { ProfileTransform } from '../types';
|
||||
|
||||
/** @public */
|
||||
export interface ProxyAuthenticator<TContext, TResult> {
|
||||
defaultProfileTransform: ProfileTransform<TResult>;
|
||||
initialize(ctx: { config: Config }): Promise<TContext>;
|
||||
@@ -27,6 +28,7 @@ export interface ProxyAuthenticator<TContext, TResult> {
|
||||
): Promise<{ result: TResult }>;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export function createProxyAuthenticator<TContext, TResult>(
|
||||
authenticator: ProxyAuthenticator<TContext, TResult>,
|
||||
): ProxyAuthenticator<TContext, TResult> {
|
||||
|
||||
@@ -19,6 +19,7 @@ import { SignInResolver } from '../types';
|
||||
import zodToJsonSchema from 'zod-to-json-schema';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
|
||||
/** @public */
|
||||
export interface SignInResolverFactory<TAuthResult, TOptions> {
|
||||
(
|
||||
...options: undefined extends TOptions
|
||||
@@ -28,6 +29,7 @@ export interface SignInResolverFactory<TAuthResult, TOptions> {
|
||||
optionsJsonSchema?: JsonObject;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface SignInResolverFactoryOptions<
|
||||
TAuthResult,
|
||||
TOptionsOutput,
|
||||
@@ -37,6 +39,7 @@ export interface SignInResolverFactoryOptions<
|
||||
create(options: TOptionsOutput): SignInResolver<TAuthResult>;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export function createSignInResolverFactory<
|
||||
TAuthResult,
|
||||
TOptionsOutput,
|
||||
|
||||
Reference in New Issue
Block a user