Merge pull request #26059 from backstage/jhaals/auth-backend-cleanup

auth-backend: deprecate createRouter
This commit is contained in:
Johan Haals
2024-08-19 09:59:35 +02:00
committed by GitHub
3 changed files with 31 additions and 21 deletions
+9 -8
View File
@@ -20,6 +20,7 @@ import { ClientAuthResponse } from '@backstage/plugin-auth-node';
import { cloudflareAccessSignInResolvers } from '@backstage/plugin-auth-backend-module-cloudflare-access-provider';
import { Config } from '@backstage/config';
import { CookieConfigurer as CookieConfigurer_2 } from '@backstage/plugin-auth-node';
import { DatabaseService } from '@backstage/backend-plugin-api';
import { decodeOAuthState } from '@backstage/plugin-auth-node';
import { DiscoveryService } from '@backstage/backend-plugin-api';
import { encodeOAuthState } from '@backstage/plugin-auth-node';
@@ -33,14 +34,14 @@ import { OAuth2ProxyResult as OAuth2ProxyResult_2 } from '@backstage/plugin-auth
import { OAuthEnvironmentHandler as OAuthEnvironmentHandler_2 } from '@backstage/plugin-auth-node';
import { OAuthState as OAuthState_2 } from '@backstage/plugin-auth-node';
import { OidcAuthResult as OidcAuthResult_2 } from '@backstage/plugin-auth-backend-module-oidc-provider';
import { PluginDatabaseManager } from '@backstage/backend-common';
import { PluginEndpointDiscovery } from '@backstage/backend-common';
import { prepareBackstageIdentityResponse as prepareBackstageIdentityResponse_2 } from '@backstage/plugin-auth-node';
import { Profile } from 'passport';
import { ProfileInfo as ProfileInfo_2 } from '@backstage/plugin-auth-node';
import { RootConfigService } from '@backstage/backend-plugin-api';
import { SignInInfo as SignInInfo_2 } from '@backstage/plugin-auth-node';
import { SignInResolver as SignInResolver_2 } from '@backstage/plugin-auth-node';
import { TokenManager } from '@backstage/backend-common';
import { TokenManagerService } from '@backstage/backend-plugin-api';
import { TokenParams as TokenParams_2 } from '@backstage/plugin-auth-node';
import { UserEntity } from '@backstage/catalog-model';
import { WebMessageResponse as WebMessageResponse_2 } from '@backstage/plugin-auth-node';
@@ -193,7 +194,7 @@ export function createAuthProviderIntegration<
// @public (undocumented)
export function createOriginFilter(config: Config): (origin: string) => boolean;
// @public (undocumented)
// @public @deprecated (undocumented)
export function createRouter(options: RouterOptions): Promise<express.Router>;
// @public
@@ -647,20 +648,20 @@ export const providers: Readonly<{
// @public @deprecated (undocumented)
export const readState: typeof decodeOAuthState;
// @public (undocumented)
// @public @deprecated (undocumented)
export interface RouterOptions {
// (undocumented)
auth?: AuthService;
// (undocumented)
catalogApi?: CatalogApi;
// (undocumented)
config: Config;
config: RootConfigService;
// (undocumented)
database: PluginDatabaseManager;
database: DatabaseService;
// (undocumented)
disableDefaultProviderFactories?: boolean;
// (undocumented)
discovery: PluginEndpointDiscovery;
discovery: DiscoveryService;
// (undocumented)
httpAuth?: HttpAuthService;
// (undocumented)
@@ -672,7 +673,7 @@ export interface RouterOptions {
// (undocumented)
tokenFactoryAlgorithm?: string;
// (undocumented)
tokenManager: TokenManager;
tokenManager: TokenManagerService;
}
// @public (undocumented)
+17 -13
View File
@@ -19,17 +19,16 @@ import Router from 'express-promise-router';
import cookieParser from 'cookie-parser';
import {
AuthService,
DatabaseService,
DiscoveryService,
HttpAuthService,
LoggerService,
RootConfigService,
TokenManagerService,
} from '@backstage/backend-plugin-api';
import { defaultAuthProviderFactories } from '../providers';
import { AuthOwnershipResolver } from '@backstage/plugin-auth-node';
import {
createLegacyAuthAdapters,
PluginDatabaseManager,
PluginEndpointDiscovery,
TokenManager,
} from '@backstage/backend-common';
import { createLegacyAuthAdapters } from '@backstage/backend-common';
import { NotFoundError } from '@backstage/errors';
import { CatalogApi } from '@backstage/catalog-client';
import {
@@ -46,16 +45,18 @@ import { readBackstageTokenExpiration } from './readBackstageTokenExpiration';
import { TokenIssuer } from '../identity/types';
import { StaticTokenIssuer } from '../identity/StaticTokenIssuer';
import { StaticKeyStore } from '../identity/StaticKeyStore';
import { Config } from '@backstage/config';
import { bindProviderRouters, ProviderFactories } from '../providers/router';
/** @public */
/**
* @public
* @deprecated Please migrate to the new backend system as this will be removed in the future.
*/
export interface RouterOptions {
logger: LoggerService;
database: PluginDatabaseManager;
config: Config;
discovery: PluginEndpointDiscovery;
tokenManager: TokenManager;
database: DatabaseService;
config: RootConfigService;
discovery: DiscoveryService;
tokenManager: TokenManagerService;
auth?: AuthService;
httpAuth?: HttpAuthService;
tokenFactoryAlgorithm?: string;
@@ -65,7 +66,10 @@ export interface RouterOptions {
ownershipResolver?: AuthOwnershipResolver;
}
/** @public */
/**
* @public
* @deprecated Please migrate to the new backend system as this will be removed in the future.
*/
export async function createRouter(
options: RouterOptions,
): Promise<express.Router> {