diff --git a/plugins/auth-backend/src/providers/atlassian/index.ts b/plugins/auth-backend/src/providers/atlassian/index.ts index cf3eb901d9..dc6ce77166 100644 --- a/plugins/auth-backend/src/providers/atlassian/index.ts +++ b/plugins/auth-backend/src/providers/atlassian/index.ts @@ -14,8 +14,5 @@ * limitations under the License. */ -export { createAtlassianProvider } from './provider'; -export type { - AtlassianAuthProvider, - AtlassianProviderOptions, -} from './provider'; +export { atlassian } from './provider'; +export type { AtlassianAuthProvider } from './provider'; diff --git a/plugins/auth-backend/src/providers/atlassian/provider.ts b/plugins/auth-backend/src/providers/atlassian/provider.ts index 2aa85dab96..82feef5369 100644 --- a/plugins/auth-backend/src/providers/atlassian/provider.ts +++ b/plugins/auth-backend/src/providers/atlassian/provider.ts @@ -58,6 +58,9 @@ export const atlassianDefaultAuthHandler: AuthHandler = async ({ profile: makeProfileInfo(fullProfile, params.id_token), }); +/** + * @deprecated This export is deprecated and will be removed in the future. + */ export class AtlassianAuthProvider implements OAuthHandlers { private readonly _strategy: AtlassianStrategy; private readonly signInResolver?: SignInResolver; @@ -161,25 +164,6 @@ export class AtlassianAuthProvider implements OAuthHandlers { } } -/** - * @public - * @deprecated This type has been inlined into the create method and will be removed. - */ -export type AtlassianProviderOptions = { - /** - * The profile transformation function used to verify and convert the auth response - * into the profile that will be presented to the user. - */ - authHandler?: AuthHandler; - - /** - * Configure sign-in for this provider, without it the provider can not be used to sign users in. - */ - signIn?: { - resolver: SignInResolver; - }; -}; - /** * Auth provider integration for atlassian auth * @@ -230,9 +214,3 @@ export const atlassian = createAuthProviderIntegration({ }); }, }); - -/** - * @public - * @deprecated Use `providers.atlassian.create` instead - */ -export const createAtlassianProvider = atlassian.create; diff --git a/plugins/auth-backend/src/providers/auth0/index.ts b/plugins/auth-backend/src/providers/auth0/index.ts index b201177d69..94a08a5809 100644 --- a/plugins/auth-backend/src/providers/auth0/index.ts +++ b/plugins/auth-backend/src/providers/auth0/index.ts @@ -14,5 +14,4 @@ * limitations under the License. */ -export { createAuth0Provider } from './provider'; -export type { Auth0ProviderOptions } from './provider'; +export { auth0 } from './provider'; diff --git a/plugins/auth-backend/src/providers/auth0/provider.ts b/plugins/auth-backend/src/providers/auth0/provider.ts index 9ddd587508..a53f504f50 100644 --- a/plugins/auth-backend/src/providers/auth0/provider.ts +++ b/plugins/auth-backend/src/providers/auth0/provider.ts @@ -169,28 +169,6 @@ export class Auth0AuthProvider implements OAuthHandlers { } } -/** - * @public - * @deprecated This type has been inlined into the create method and will be removed. - */ -export type Auth0ProviderOptions = { - /** - * The profile transformation function used to verify and convert the auth response - * into the profile that will be presented to the user. - */ - authHandler?: AuthHandler; - - /** - * Configure sign-in for this provider, without it the provider can not be used to sign users in. - */ - signIn?: { - /** - * Maps an auth result to a Backstage identity for the user. - */ - resolver: SignInResolver; - }; -}; - /** * Auth provider integration for auth0 auth * @@ -249,9 +227,3 @@ export const auth0 = createAuthProviderIntegration({ }); }, }); - -/** - * @public - * @deprecated Use `providers.auth0.create` instead. - */ -export const createAuth0Provider = auth0.create; diff --git a/plugins/auth-backend/src/providers/aws-alb/index.ts b/plugins/auth-backend/src/providers/aws-alb/index.ts index 710d86ca3d..9b3e8920ac 100644 --- a/plugins/auth-backend/src/providers/aws-alb/index.ts +++ b/plugins/auth-backend/src/providers/aws-alb/index.ts @@ -14,5 +14,5 @@ * limitations under the License. */ -export { createAwsAlbProvider } from './provider'; -export type { AwsAlbProviderOptions, AwsAlbResult } from './provider'; +export { awsAlb } from './provider'; +export type { AwsAlbResult } from './provider'; diff --git a/plugins/auth-backend/src/providers/aws-alb/provider.ts b/plugins/auth-backend/src/providers/aws-alb/provider.ts index b8d43a11e6..5af606539e 100644 --- a/plugins/auth-backend/src/providers/aws-alb/provider.ts +++ b/plugins/auth-backend/src/providers/aws-alb/provider.ts @@ -211,28 +211,6 @@ export class AwsAlbAuthProvider implements AuthProviderRouteHandlers { }; } -/** - * @public - * @deprecated This type has been inlined into the create method and will be removed. - */ -export type AwsAlbProviderOptions = { - /** - * The profile transformation function used to verify and convert the auth response - * into the profile that will be presented to the user. - */ - authHandler?: AuthHandler; - - /** - * Configure sign-in for this provider, without it the provider can not be used to sign users in. - */ - signIn: { - /** - * Maps an auth result to a Backstage identity for the user. - */ - resolver: SignInResolver; - }; -}; - /** * Auth provider integration for AWS ALB auth * @@ -282,9 +260,3 @@ export const awsAlb = createAuthProviderIntegration({ }; }, }); - -/** - * @public - * @deprecated Use `providers.awsAlb.create` instead - */ -export const createAwsAlbProvider = awsAlb.create; diff --git a/plugins/auth-backend/src/providers/bitbucket/index.ts b/plugins/auth-backend/src/providers/bitbucket/index.ts index 55a5735655..9d82c1066c 100644 --- a/plugins/auth-backend/src/providers/bitbucket/index.ts +++ b/plugins/auth-backend/src/providers/bitbucket/index.ts @@ -14,13 +14,8 @@ * limitations under the License. */ -export { - createBitbucketProvider, - bitbucketUsernameSignInResolver, - bitbucketUserIdSignInResolver, -} from './provider'; +export { bitbucket } from './provider'; export type { - BitbucketProviderOptions, BitbucketPassportProfile, BitbucketOAuthResult, } from './provider'; diff --git a/plugins/auth-backend/src/providers/bitbucket/provider.ts b/plugins/auth-backend/src/providers/bitbucket/provider.ts index 5b9919764b..e3bd044466 100644 --- a/plugins/auth-backend/src/providers/bitbucket/provider.ts +++ b/plugins/auth-backend/src/providers/bitbucket/provider.ts @@ -190,28 +190,6 @@ export class BitbucketAuthProvider implements OAuthHandlers { } } -/** - * @public - * @deprecated This type has been inlined into the create method and will be removed. - */ -export type BitbucketProviderOptions = { - /** - * The profile transformation function used to verify and convert the auth response - * into the profile that will be presented to the user. - */ - authHandler?: AuthHandler; - - /** - * Configure sign-in for this provider, without it the provider can not be used to sign users in. - */ - signIn?: { - /** - * Maps an auth result to a Backstage identity for the user. - */ - resolver: SignInResolver; - }; -}; - /** * Auth provider integration for BitBucket auth * @@ -305,23 +283,3 @@ export const bitbucket = createAuthProviderIntegration({ }, }, }); - -/** - * @public - * @deprecated Use `providers.bitbucket.create` instead - */ -export const createBitbucketProvider = bitbucket.create; - -/** - * @public - * @deprecated Use `providers.bitbucket.resolvers.usernameMatchingUserEntityAnnotation()` instead. - */ -export const bitbucketUsernameSignInResolver = - bitbucket.resolvers.usernameMatchingUserEntityAnnotation(); - -/** - * @public - * @deprecated Use `providers.bitbucket.resolvers.userIdMatchingUserEntityAnnotation()` instead. - */ -export const bitbucketUserIdSignInResolver = - bitbucket.resolvers.userIdMatchingUserEntityAnnotation(); diff --git a/plugins/auth-backend/src/providers/factories.ts b/plugins/auth-backend/src/providers/factories.ts deleted file mode 100644 index 42d3569815..0000000000 --- a/plugins/auth-backend/src/providers/factories.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2020 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { createGithubProvider } from './github'; -import { createGitlabProvider } from './gitlab'; -import { createGoogleProvider } from './google'; -import { createOAuth2Provider } from './oauth2'; -import { createOidcProvider } from './oidc'; -import { createOktaProvider } from './okta'; -import { createSamlProvider } from './saml'; -import { createAuth0Provider } from './auth0'; -import { createMicrosoftProvider } from './microsoft'; -import { createOneLoginProvider } from './onelogin'; -import { AuthProviderFactory } from './types'; -import { createAwsAlbProvider } from './aws-alb'; -import { createBitbucketProvider } from './bitbucket'; -import { createAtlassianProvider } from './atlassian'; - -export const factories: { [providerId: string]: AuthProviderFactory } = { - google: createGoogleProvider(), - github: createGithubProvider(), - gitlab: createGitlabProvider(), - saml: createSamlProvider(), - okta: createOktaProvider(), - auth0: createAuth0Provider(), - microsoft: createMicrosoftProvider(), - oauth2: createOAuth2Provider(), - oidc: createOidcProvider(), - onelogin: createOneLoginProvider(), - awsalb: createAwsAlbProvider(), - bitbucket: createBitbucketProvider(), - atlassian: createAtlassianProvider(), -}; diff --git a/plugins/auth-backend/src/providers/gcp-iap/index.ts b/plugins/auth-backend/src/providers/gcp-iap/index.ts index 97e31b0051..12f76ec142 100644 --- a/plugins/auth-backend/src/providers/gcp-iap/index.ts +++ b/plugins/auth-backend/src/providers/gcp-iap/index.ts @@ -14,9 +14,5 @@ * limitations under the License. */ -export { createGcpIapProvider } from './provider'; -export type { - GcpIapProviderOptions, - GcpIapResult, - GcpIapTokenInfo, -} from './types'; +export { gcpIap } from './provider'; +export type { GcpIapResult, GcpIapTokenInfo } from './types'; diff --git a/plugins/auth-backend/src/providers/gcp-iap/provider.ts b/plugins/auth-backend/src/providers/gcp-iap/provider.ts index cb5d5979cd..500b062d5b 100644 --- a/plugins/auth-backend/src/providers/gcp-iap/provider.ts +++ b/plugins/auth-backend/src/providers/gcp-iap/provider.ts @@ -117,9 +117,3 @@ export const gcpIap = createAuthProviderIntegration({ }; }, }); - -/** - * @public - * @deprecated Use `providers.gcpIap.create` instead - */ -export const createGcpIapProvider = gcpIap.create; diff --git a/plugins/auth-backend/src/providers/gcp-iap/types.ts b/plugins/auth-backend/src/providers/gcp-iap/types.ts index 6e5a022a3d..25828b7d51 100644 --- a/plugins/auth-backend/src/providers/gcp-iap/types.ts +++ b/plugins/auth-backend/src/providers/gcp-iap/types.ts @@ -15,7 +15,7 @@ */ import { JsonValue } from '@backstage/types'; -import { AuthHandler, AuthResponse, SignInResolver } from '../types'; +import { AuthResponse } from '../types'; /** * The header name used by the IAP. @@ -69,27 +69,3 @@ export type GcpIapProviderInfo = { * The shape of the response to return to callers. */ export type GcpIapResponse = AuthResponse; - -/** - * @public - * @deprecated This type has been inlined into the create method and will be removed. - */ -export type GcpIapProviderOptions = { - /** - * The profile transformation function used to verify and convert the auth - * response into the profile that will be presented to the user. The default - * implementation just provides the authenticated email that the IAP - * presented. - */ - authHandler?: AuthHandler; - - /** - * Configures sign-in for this provider. - */ - signIn: { - /** - * Maps an auth result to a Backstage identity for the user. - */ - resolver: SignInResolver; - }; -}; diff --git a/plugins/auth-backend/src/providers/github/index.ts b/plugins/auth-backend/src/providers/github/index.ts index a855b13b83..2f4bb1f6cd 100644 --- a/plugins/auth-backend/src/providers/github/index.ts +++ b/plugins/auth-backend/src/providers/github/index.ts @@ -14,5 +14,5 @@ * limitations under the License. */ -export { createGithubProvider } from './provider'; -export type { GithubOAuthResult, GithubProviderOptions } from './provider'; +export { github } from './provider'; +export type { GithubOAuthResult } from './provider'; diff --git a/plugins/auth-backend/src/providers/github/provider.ts b/plugins/auth-backend/src/providers/github/provider.ts index e018a6cf99..9c115b5eb8 100644 --- a/plugins/auth-backend/src/providers/github/provider.ts +++ b/plugins/auth-backend/src/providers/github/provider.ts @@ -227,46 +227,6 @@ export class GithubAuthProvider implements OAuthHandlers { } } -/** - * @public - * @deprecated This type has been inlined into the create method and will be removed. - */ -export type GithubProviderOptions = { - /** - * The profile transformation function used to verify and convert the auth response - * into the profile that will be presented to the user. - */ - authHandler?: AuthHandler; - - /** - * Configure sign-in for this provider, without it the provider can not be used to sign users in. - */ - signIn?: { - /** - * Maps an auth result to a Backstage identity for the user. - */ - resolver: SignInResolver; - }; - - /** - * The state encoder used to encode the 'state' parameter on the OAuth request. - * - * It should return a string that takes the state params (from the request), url encodes the params - * and finally base64 encodes them. - * - * Providing your own stateEncoder will allow you to add addition parameters to the state field. - * - * It is typed as follows: - * `export type StateEncoder = (input: OAuthState) => Promise<{encodedState: string}>;` - * - * Note: the stateEncoder must encode a 'nonce' value and an 'env' value. Without this, the OAuth flow will fail - * (These two values will be set by the req.state by default) - * - * For more information, please see the helper module in ../../oauth/helpers #readState - */ - stateEncoder?: StateEncoder; -}; - /** * Auth provider integration for GitHub auth * @@ -381,9 +341,3 @@ export const github = createAuthProviderIntegration({ }, }, }); - -/** - * @public - * @deprecated Use `providers.github.create` instead - */ -export const createGithubProvider = github.create; diff --git a/plugins/auth-backend/src/providers/gitlab/index.ts b/plugins/auth-backend/src/providers/gitlab/index.ts index 52ede48756..9b60d1f18a 100644 --- a/plugins/auth-backend/src/providers/gitlab/index.ts +++ b/plugins/auth-backend/src/providers/gitlab/index.ts @@ -14,5 +14,4 @@ * limitations under the License. */ -export { createGitlabProvider } from './provider'; -export type { GitlabProviderOptions } from './provider'; +export { gitlab } from './provider'; diff --git a/plugins/auth-backend/src/providers/gitlab/provider.ts b/plugins/auth-backend/src/providers/gitlab/provider.ts index 868357bcda..c24c2e128d 100644 --- a/plugins/auth-backend/src/providers/gitlab/provider.ts +++ b/plugins/auth-backend/src/providers/gitlab/provider.ts @@ -178,31 +178,6 @@ export class GitlabAuthProvider implements OAuthHandlers { } } -/** - * @public - * @deprecated This type has been inlined into the create method and will be removed. - */ -export type GitlabProviderOptions = { - /** - * The profile transformation function used to verify and convert the auth response - * into the profile that will be presented to the user. - */ - authHandler?: AuthHandler; - - /** - * Configure sign-in for this provider, without it the provider can not be used to sign users in. - */ - /** - * Maps an auth result to a Backstage identity for the user. - * - * Set to `'email'` to use the default email-based sign in resolver, which will search - * the catalog for a single user entity that has a matching `microsoft.com/email` annotation. - */ - signIn?: { - resolver: SignInResolver; - }; -}; - /** * Auth provider integration for GitLab auth * @@ -254,9 +229,3 @@ export const gitlab = createAuthProviderIntegration({ }); }, }); - -/** - * @public - * @deprecated Use `providers.gitlab.create` instead - */ -export const createGitlabProvider = gitlab.create; diff --git a/plugins/auth-backend/src/providers/google/index.ts b/plugins/auth-backend/src/providers/google/index.ts index 209484ad04..5e8c3236e4 100644 --- a/plugins/auth-backend/src/providers/google/index.ts +++ b/plugins/auth-backend/src/providers/google/index.ts @@ -14,5 +14,4 @@ * limitations under the License. */ -export { createGoogleProvider, googleEmailSignInResolver } from './provider'; -export type { GoogleProviderOptions } from './provider'; +export { google } from './provider'; diff --git a/plugins/auth-backend/src/providers/google/provider.ts b/plugins/auth-backend/src/providers/google/provider.ts index 2d58bc2aa6..f60d4e9947 100644 --- a/plugins/auth-backend/src/providers/google/provider.ts +++ b/plugins/auth-backend/src/providers/google/provider.ts @@ -168,28 +168,6 @@ export class GoogleAuthProvider implements OAuthHandlers { } } -/** - * @public - * @deprecated This type has been inlined into the create method and will be removed. - */ -export type GoogleProviderOptions = { - /** - * The profile transformation function used to verify and convert the auth response - * into the profile that will be presented to the user. - */ - authHandler?: AuthHandler; - - /** - * Configure sign-in for this provider, without it the provider can not be used to sign users in. - */ - signIn?: { - /** - * Maps an auth result to a Backstage identity for the user. - */ - resolver: SignInResolver; - }; -}; - /** * Auth provider integration for Google auth * @@ -272,16 +250,3 @@ export const google = createAuthProviderIntegration({ }, }, }); - -/** - * @public - * @deprecated Use `providers.google.create` instead. - */ -export const createGoogleProvider = google.create; - -/** - * @public - * @deprecated Use `providers.google.resolvers.emailMatchingUserEntityAnnotation()` instead. - */ -export const googleEmailSignInResolver = - google.resolvers.emailMatchingUserEntityAnnotation(); diff --git a/plugins/auth-backend/src/providers/index.ts b/plugins/auth-backend/src/providers/index.ts index 1f33a60e55..bac1143fd1 100644 --- a/plugins/auth-backend/src/providers/index.ts +++ b/plugins/auth-backend/src/providers/index.ts @@ -30,9 +30,7 @@ export * from './onelogin'; export * from './saml'; export * from './gcp-iap'; -export { providers } from './providers'; - -export { factories as defaultAuthProviderFactories } from './factories'; +export { providers, defaultAuthProviderFactories } from './providers'; export type { AuthProviderConfig, diff --git a/plugins/auth-backend/src/providers/microsoft/index.ts b/plugins/auth-backend/src/providers/microsoft/index.ts index 3167de5d0d..16dadc3bb0 100644 --- a/plugins/auth-backend/src/providers/microsoft/index.ts +++ b/plugins/auth-backend/src/providers/microsoft/index.ts @@ -14,8 +14,4 @@ * limitations under the License. */ -export { - createMicrosoftProvider, - microsoftEmailSignInResolver, -} from './provider'; -export type { MicrosoftProviderOptions } from './provider'; +export { microsoft } from './provider'; diff --git a/plugins/auth-backend/src/providers/microsoft/provider.ts b/plugins/auth-backend/src/providers/microsoft/provider.ts index 0c58049619..db79dba225 100644 --- a/plugins/auth-backend/src/providers/microsoft/provider.ts +++ b/plugins/auth-backend/src/providers/microsoft/provider.ts @@ -190,28 +190,6 @@ export class MicrosoftAuthProvider implements OAuthHandlers { } } -/** - * @public - * @deprecated This type has been inlined into the create method and will be removed. - */ -export type MicrosoftProviderOptions = { - /** - * The profile transformation function used to verify and convert the auth response - * into the profile that will be presented to the user. - */ - authHandler?: AuthHandler; - - /** - * Configure sign-in for this provider, without it the provider can not be used to sign users in. - */ - signIn?: { - /** - * Maps an auth result to a Backstage identity for the user. - */ - resolver: SignInResolver; - }; -}; - /** * Auth provider integration for Microsoft auth * @@ -301,16 +279,3 @@ export const microsoft = createAuthProviderIntegration({ }, }, }); - -/** - * @public - * @deprecated Use `providers.microsoft.create` instead - */ -export const createMicrosoftProvider = microsoft.create; - -/** - * @public - * @deprecated Use `providers.microsoft.resolvers.emailMatchingUserEntityAnnotation()` instead. - */ -export const microsoftEmailSignInResolver = - microsoft.resolvers.emailMatchingUserEntityAnnotation(); diff --git a/plugins/auth-backend/src/providers/oauth2-proxy/index.ts b/plugins/auth-backend/src/providers/oauth2-proxy/index.ts index 62304b1d1f..d3004f31e4 100644 --- a/plugins/auth-backend/src/providers/oauth2-proxy/index.ts +++ b/plugins/auth-backend/src/providers/oauth2-proxy/index.ts @@ -14,5 +14,5 @@ * limitations under the License. */ -export { createOauth2ProxyProvider } from './provider'; -export type { Oauth2ProxyProviderOptions, OAuth2ProxyResult } from './provider'; +export { oauth2Proxy } from './provider'; +export type { OAuth2ProxyResult } from './provider'; diff --git a/plugins/auth-backend/src/providers/oauth2-proxy/provider.ts b/plugins/auth-backend/src/providers/oauth2-proxy/provider.ts index 625c9e3d62..3ac7d09000 100644 --- a/plugins/auth-backend/src/providers/oauth2-proxy/provider.ts +++ b/plugins/auth-backend/src/providers/oauth2-proxy/provider.ts @@ -80,27 +80,6 @@ export type OAuth2ProxyResult = { getHeader(name: string): string | undefined; }; -/** - * @public - * @deprecated This type has been inlined into the create method and will be removed. - */ -export type Oauth2ProxyProviderOptions = { - /** - * Configure an auth handler to generate a profile for the user. - */ - authHandler: AuthHandler>; - - /** - * Configure sign-in for this provider, without it the provider can not be used to sign users in. - */ - signIn: { - /** - * Maps an auth result to a Backstage identity for the user. - */ - resolver: SignInResolver>; - }; -}; - interface Options { resolverContext: AuthResolverContext; signInResolver: SignInResolver>; @@ -231,9 +210,3 @@ export const oauth2Proxy = createAuthProviderIntegration({ }; }, }); - -/** - * @public - * @deprecated Use `providers.oauth2Proxy.create` instead - */ -export const createOauth2ProxyProvider = oauth2Proxy.create; diff --git a/plugins/auth-backend/src/providers/oauth2/index.ts b/plugins/auth-backend/src/providers/oauth2/index.ts index d68208a148..14485e04ff 100644 --- a/plugins/auth-backend/src/providers/oauth2/index.ts +++ b/plugins/auth-backend/src/providers/oauth2/index.ts @@ -14,5 +14,4 @@ * limitations under the License. */ -export { createOAuth2Provider } from './provider'; -export type { OAuth2ProviderOptions } from './provider'; +export { oauth2 } from './provider'; diff --git a/plugins/auth-backend/src/providers/oauth2/provider.ts b/plugins/auth-backend/src/providers/oauth2/provider.ts index 6b4787e985..6fa649c421 100644 --- a/plugins/auth-backend/src/providers/oauth2/provider.ts +++ b/plugins/auth-backend/src/providers/oauth2/provider.ts @@ -192,18 +192,6 @@ export class OAuth2AuthProvider implements OAuthHandlers { } } -/** - * @public - * @deprecated This type has been inlined into the create method and will be removed. - */ -export type OAuth2ProviderOptions = { - authHandler?: AuthHandler; - - signIn?: { - resolver: SignInResolver; - }; -}; - /** * Auth provider integration for generic OAuth2 auth * @@ -260,9 +248,3 @@ export const oauth2 = createAuthProviderIntegration({ }); }, }); - -/** - * @public - * @deprecated Use `providers.oauth2.create` instead - */ -export const createOAuth2Provider = oauth2.create; diff --git a/plugins/auth-backend/src/providers/oidc/index.ts b/plugins/auth-backend/src/providers/oidc/index.ts index e63c9920df..6b2282411c 100644 --- a/plugins/auth-backend/src/providers/oidc/index.ts +++ b/plugins/auth-backend/src/providers/oidc/index.ts @@ -14,5 +14,5 @@ * limitations under the License. */ -export type { OidcAuthResult, OidcProviderOptions } from './provider'; -export { createOidcProvider } from './provider'; +export { oidc } from './provider'; +export type { OidcAuthResult } from './provider'; diff --git a/plugins/auth-backend/src/providers/oidc/provider.test.ts b/plugins/auth-backend/src/providers/oidc/provider.test.ts index 59a717f132..ee8aa50b01 100644 --- a/plugins/auth-backend/src/providers/oidc/provider.test.ts +++ b/plugins/auth-backend/src/providers/oidc/provider.test.ts @@ -23,7 +23,7 @@ import { rest } from 'msw'; import { setupServer } from 'msw/node'; import { ClientMetadata, IssuerMetadata } from 'openid-client'; import { OAuthAdapter } from '../../lib/oauth'; -import { createOidcProvider, OidcAuthProvider, Options } from './provider'; +import { oidc, OidcAuthProvider, Options } from './provider'; import { AuthResolverContext } from '../types'; const issuerMetadata = { @@ -155,7 +155,7 @@ describe('OidcAuthProvider', () => { expect(requestSequence).toEqual([0, 1, 2].map(i => requests[i].url)); }); - it('createOidcProvider', async () => { + it('oidc.create', async () => { const handler = jest.fn((_req, res, ctx) => { return res( ctx.status(200), @@ -172,7 +172,7 @@ describe('OidcAuthProvider', () => { metadataUrl: 'https://oidc.test/.well-known/openid-configuration', }, } as any); - const provider = createOidcProvider()({ + const provider = oidc.create()({ globalConfig: { appUrl: 'https://oidc.test', baseUrl: 'https://oidc.test', diff --git a/plugins/auth-backend/src/providers/oidc/provider.ts b/plugins/auth-backend/src/providers/oidc/provider.ts index 69a65d1cae..eb963a3711 100644 --- a/plugins/auth-backend/src/providers/oidc/provider.ts +++ b/plugins/auth-backend/src/providers/oidc/provider.ts @@ -198,18 +198,6 @@ export class OidcAuthProvider implements OAuthHandlers { } } -/** - * @public - * @deprecated This type has been inlined into the create method and will be removed. - */ -export type OidcProviderOptions = { - authHandler?: AuthHandler; - - signIn?: { - resolver: SignInResolver; - }; -}; - /** * Auth provider integration for generic OpenID Connect auth * @@ -268,9 +256,3 @@ export const oidc = createAuthProviderIntegration({ }); }, }); - -/** - * @public - * @deprecated Use `providers.oidc.create` instead - */ -export const createOidcProvider = oidc.create; diff --git a/plugins/auth-backend/src/providers/okta/index.ts b/plugins/auth-backend/src/providers/okta/index.ts index fd9ebf46da..3387fa3668 100644 --- a/plugins/auth-backend/src/providers/okta/index.ts +++ b/plugins/auth-backend/src/providers/okta/index.ts @@ -14,5 +14,4 @@ * limitations under the License. */ -export { createOktaProvider, oktaEmailSignInResolver } from './provider'; -export type { OktaProviderOptions } from './provider'; +export { okta } from './provider'; diff --git a/plugins/auth-backend/src/providers/okta/provider.ts b/plugins/auth-backend/src/providers/okta/provider.ts index 98cec6df3a..de9d128641 100644 --- a/plugins/auth-backend/src/providers/okta/provider.ts +++ b/plugins/auth-backend/src/providers/okta/provider.ts @@ -192,28 +192,6 @@ export class OktaAuthProvider implements OAuthHandlers { } } -/** - * @public - * @deprecated This type has been inlined into the create method and will be removed. - */ -export type OktaProviderOptions = { - /** - * The profile transformation function used to verify and convert the auth response - * into the profile that will be presented to the user. - */ - authHandler?: AuthHandler; - - /** - * Configure sign-in for this provider, without it the provider can not be used to sign users in. - */ - signIn?: { - /** - * Maps an auth result to a Backstage identity for the user. - */ - resolver: SignInResolver; - }; -}; - /** * Auth provider integration for Okta auth * @@ -305,16 +283,3 @@ export const okta = createAuthProviderIntegration({ }, }, }); - -/** - * @public - * @deprecated Use `providers.okta.create` instead - */ -export const createOktaProvider = okta.create; - -/** - * @public - * @deprecated Use `providers.okta.resolvers.emailMatchingUserEntityAnnotation()` instead. - */ -export const oktaEmailSignInResolver = - okta.resolvers.emailMatchingUserEntityAnnotation(); diff --git a/plugins/auth-backend/src/providers/onelogin/index.ts b/plugins/auth-backend/src/providers/onelogin/index.ts index 63cf0be3cd..3f356029fb 100644 --- a/plugins/auth-backend/src/providers/onelogin/index.ts +++ b/plugins/auth-backend/src/providers/onelogin/index.ts @@ -14,5 +14,4 @@ * limitations under the License. */ -export { createOneLoginProvider } from './provider'; -export type { OneLoginProviderOptions } from './provider'; +export { onelogin } from './provider'; diff --git a/plugins/auth-backend/src/providers/onelogin/provider.ts b/plugins/auth-backend/src/providers/onelogin/provider.ts index d81eb3d83c..59b57b3851 100644 --- a/plugins/auth-backend/src/providers/onelogin/provider.ts +++ b/plugins/auth-backend/src/providers/onelogin/provider.ts @@ -166,28 +166,6 @@ export class OneLoginProvider implements OAuthHandlers { } } -/** - * @public - * @deprecated This type has been inlined into the create method and will be removed. - */ -export type OneLoginProviderOptions = { - /** - * The profile transformation function used to verify and convert the auth response - * into the profile that will be presented to the user. - */ - authHandler?: AuthHandler; - - /** - * Configure sign-in for this provider, without it the provider can not be used to sign users in. - */ - signIn?: { - /** - * Maps an auth result to a Backstage identity for the user. - */ - resolver: SignInResolver; - }; -}; - /** * Auth provider integration for OneLogin auth * @@ -244,9 +222,3 @@ export const onelogin = createAuthProviderIntegration({ }); }, }); - -/** - * @public - * @deprecated Use `providers.onelogin.create` instead - */ -export const createOneLoginProvider = onelogin.create; diff --git a/plugins/auth-backend/src/providers/providers.ts b/plugins/auth-backend/src/providers/providers.ts index 3d49e2bbbb..71df8223ef 100644 --- a/plugins/auth-backend/src/providers/providers.ts +++ b/plugins/auth-backend/src/providers/providers.ts @@ -14,21 +14,22 @@ * limitations under the License. */ -import { atlassian } from './atlassian/provider'; -import { auth0 } from './auth0/provider'; -import { awsAlb } from './aws-alb/provider'; -import { bitbucket } from './bitbucket/provider'; -import { gcpIap } from './gcp-iap/provider'; -import { github } from './github/provider'; -import { gitlab } from './gitlab/provider'; -import { google } from './google/provider'; -import { microsoft } from './microsoft/provider'; -import { oauth2 } from './oauth2/provider'; -import { oauth2Proxy } from './oauth2-proxy/provider'; -import { oidc } from './oidc/provider'; -import { okta } from './okta/provider'; -import { onelogin } from './onelogin/provider'; -import { saml } from './saml/provider'; +import { atlassian } from './atlassian'; +import { auth0 } from './auth0'; +import { awsAlb } from './aws-alb'; +import { bitbucket } from './bitbucket'; +import { gcpIap } from './gcp-iap'; +import { github } from './github'; +import { gitlab } from './gitlab'; +import { google } from './google'; +import { microsoft } from './microsoft'; +import { oauth2 } from './oauth2'; +import { oauth2Proxy } from './oauth2-proxy'; +import { oidc } from './oidc'; +import { okta } from './okta'; +import { onelogin } from './onelogin'; +import { saml } from './saml'; +import { AuthProviderFactory } from './types'; /** * All built-in auth provider integrations. @@ -52,3 +53,26 @@ export const providers = Object.freeze({ onelogin, saml, }); + +/** + * All auth provider factories that are installed by default. + * + * @public + */ +export const defaultAuthProviderFactories: { + [providerId: string]: AuthProviderFactory; +} = { + google: google.create(), + github: github.create(), + gitlab: gitlab.create(), + saml: saml.create(), + okta: okta.create(), + auth0: auth0.create(), + microsoft: microsoft.create(), + oauth2: oauth2.create(), + oidc: oidc.create(), + onelogin: onelogin.create(), + awsalb: awsAlb.create(), + bitbucket: bitbucket.create(), + atlassian: atlassian.create(), +}; diff --git a/plugins/auth-backend/src/providers/saml/index.ts b/plugins/auth-backend/src/providers/saml/index.ts index 8d36e17d29..d59f7bf0a7 100644 --- a/plugins/auth-backend/src/providers/saml/index.ts +++ b/plugins/auth-backend/src/providers/saml/index.ts @@ -14,8 +14,5 @@ * limitations under the License. */ -export { - createSamlProvider, - samlNameIdEntityNameSignInResolver, -} from './provider'; -export type { SamlProviderOptions, SamlAuthResult } from './provider'; +export { saml } from './provider'; +export type { SamlAuthResult } from './provider'; diff --git a/plugins/auth-backend/src/providers/saml/provider.ts b/plugins/auth-backend/src/providers/saml/provider.ts index 4f5076b410..3d35f46628 100644 --- a/plugins/auth-backend/src/providers/saml/provider.ts +++ b/plugins/auth-backend/src/providers/saml/provider.ts @@ -132,28 +132,6 @@ export class SamlAuthProvider implements AuthProviderRouteHandlers { type SignatureAlgorithm = 'sha1' | 'sha256' | 'sha512'; -/** - * @public - * @deprecated This type has been inlined into the create method and will be removed. - */ -export type SamlProviderOptions = { - /** - * The profile transformation function used to verify and convert the auth response - * into the profile that will be presented to the user. - */ - authHandler?: AuthHandler; - - /** - * Configure sign-in for this provider, without it the provider can not be used to sign users in. - */ - signIn?: { - /** - * Maps an auth result to a Backstage identity for the user. - */ - resolver: SignInResolver; - }; -}; - /** * Auth provider integration for SAML auth * @@ -230,16 +208,3 @@ export const saml = createAuthProviderIntegration({ }, }, }); - -/** - * @public - * @deprecated Use `providers.saml.create` instead - */ -export const createSamlProvider = saml.create; - -/** - * @public - * @deprecated Use `providers.saml.resolvers.nameIdMatchingUserEntityName()` instead. - */ -export const samlNameIdEntityNameSignInResolver = - saml.resolvers.nameIdMatchingUserEntityName();