auth refactor type fixes

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-08-08 15:36:18 +02:00
parent 3db911fc98
commit 258b410cad
17 changed files with 27 additions and 11 deletions
-3
View File
@@ -31,9 +31,6 @@ export * from './lib/flow';
// OAuth wrapper over a passport or a custom `strategy`.
export * from './lib/oauth';
// Helpers to convert new API in @backstage/plugin-auth-node to old API
export * from './lib/legacy';
export * from './lib/catalog';
export { getDefaultOwnershipEntityRefs } from './lib/resolvers';
@@ -22,7 +22,7 @@ import { AuthHandler } from '../../providers';
import { OAuthResult } from '../oauth';
import { PassportProfile } from '../passport/types';
/** @public */
/** @internal */
export function adaptLegacyOAuthHandler(
authHandler?: AuthHandler<OAuthResult>,
): ProfileTransform<OAuthAuthenticatorResult<PassportProfile>> | undefined {
@@ -21,7 +21,7 @@ import {
} from '@backstage/plugin-auth-node';
import { OAuthResult } from '../oauth';
/** @public */
/** @internal */
export function adaptLegacyOAuthSignInResolver(
signInResolver?: SignInResolver<OAuthResult>,
): SignInResolver<OAuthAuthenticatorResult<PassportProfile>> | undefined {
@@ -21,6 +21,7 @@ import {
} from '@backstage/plugin-auth-node';
import { OAuthResult } from '../oauth';
/** @internal */
export function adaptOAuthSignInResolverToLegacy<
TKeys extends string,
>(resolvers: {
@@ -52,7 +52,7 @@ export const TEN_MINUTES_MS = 600 * 1000;
/**
* @public
* @deprecated
* @deprecated Use `createOAuthRouteHandlers` from `@backstage/plugin-auth-node` instead
*/
export type OAuthAdapterOptions = {
providerId: string;
@@ -20,4 +20,4 @@ import { OAuthEnvironmentHandler as _OAuthEnvironmentHandler } from '@backstage/
* @public
* @deprecated import from `@backstage/plugin-auth-node` instead
*/
export type OAuthEnvironmentHandler = _OAuthEnvironmentHandler;
export const OAuthEnvironmentHandler = _OAuthEnvironmentHandler;
+1 -1
View File
@@ -26,7 +26,7 @@ import { OAuthStartResponse, ProfileInfo } from '../../providers/types';
* Common options for passport.js-based OAuth providers
*
* @public
* @deprecated
* @deprecated No longer in use
*/
export type OAuthProviderOptions = {
/**
@@ -32,6 +32,6 @@ export type GcpIapTokenInfo = _GcpIapTokenInfo;
* callbacks.
*
* @public
* @deprecated
* @deprecated import from `@backstage/plugin-auth-backend-module-gcp-iap-provider` instead
*/
export type GcpIapResult = _GcpIapResult;
@@ -45,6 +45,9 @@ describe('MicrosoftAuthProvider', () => {
},
})({
providerId: 'microsoft',
baseUrl: 'http://backstage.test/api/auth',
appUrl: 'http://backstage.test',
isOriginAllowed: _ => true,
globalConfig: {
baseUrl: 'http://backstage.test/api/auth',
appUrl: 'http://backstage.test',