diff --git a/.changeset/large-balloons-brush.md b/.changeset/large-balloons-brush.md new file mode 100644 index 0000000000..0dcada12bf --- /dev/null +++ b/.changeset/large-balloons-brush.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-auth-node': minor +--- + +**BREAKING**: The recently introduced `ProxyAuthenticator.initialize()` method is no longer `async` to match the way the OAuth equivalent is implemented. diff --git a/.changeset/rare-pants-reply.md b/.changeset/rare-pants-reply.md new file mode 100644 index 0000000000..d37192048c --- /dev/null +++ b/.changeset/rare-pants-reply.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-auth-backend-module-gcp-iap-provider': minor +--- + +**BREAKING** `gcpIapAuthenticator.initialize()` is no longer `async` diff --git a/plugins/auth-backend-module-gcp-iap-provider/src/authenticator.test.ts b/plugins/auth-backend-module-gcp-iap-provider/src/authenticator.test.ts index 51efbe1a04..5f90d3a379 100644 --- a/plugins/auth-backend-module-gcp-iap-provider/src/authenticator.test.ts +++ b/plugins/auth-backend-module-gcp-iap-provider/src/authenticator.test.ts @@ -29,7 +29,7 @@ jest.mock('./helpers', () => ({ describe('GcpIapProvider', () => { it('should find default JWT header', async () => { - const ctx = await gcpIapAuthenticator.initialize({ + const ctx = gcpIapAuthenticator.initialize({ config: mockServices.rootConfig({ data: { audience: 'my-audience' } }), }); await expect( @@ -50,7 +50,7 @@ describe('GcpIapProvider', () => { it('should find custom JWT header', async () => { const jwtHeader = 'x-custom-header'; - const ctx = await gcpIapAuthenticator.initialize({ + const ctx = gcpIapAuthenticator.initialize({ config: mockServices.rootConfig({ data: { audience: 'my-audience', jwtHeader }, }), @@ -70,7 +70,7 @@ describe('GcpIapProvider', () => { }); it('should throw if header is missing', async () => { - const ctx = await gcpIapAuthenticator.initialize({ + const ctx = gcpIapAuthenticator.initialize({ config: mockServices.rootConfig({ data: { audience: 'my-audience' }, }), diff --git a/plugins/auth-backend-module-gcp-iap-provider/src/authenticator.ts b/plugins/auth-backend-module-gcp-iap-provider/src/authenticator.ts index ca104ded86..9bb68fcbb3 100644 --- a/plugins/auth-backend-module-gcp-iap-provider/src/authenticator.ts +++ b/plugins/auth-backend-module-gcp-iap-provider/src/authenticator.ts @@ -29,7 +29,7 @@ export const gcpIapAuthenticator = createProxyAuthenticator({ defaultProfileTransform: async (result: GcpIapResult) => { return { profile: { email: result.iapToken.email } }; }, - async initialize({ config }) { + initialize({ config }) { const audience = config.getString('audience'); const jwtHeader = config.getOptionalString('jwtHeader') ?? DEFAULT_IAP_JWT_HEADER; diff --git a/plugins/auth-node/api-report.md b/plugins/auth-node/api-report.md index a782847d7a..a01de2cf46 100644 --- a/plugins/auth-node/api-report.md +++ b/plugins/auth-node/api-report.md @@ -550,7 +550,7 @@ export interface ProxyAuthenticator { // (undocumented) defaultProfileTransform: ProfileTransform; // (undocumented) - initialize(ctx: { config: Config }): Promise; + initialize(ctx: { config: Config }): TContext; } // @public (undocumented) diff --git a/plugins/auth-node/src/proxy/types.ts b/plugins/auth-node/src/proxy/types.ts index 969b022abb..0f52feaac4 100644 --- a/plugins/auth-node/src/proxy/types.ts +++ b/plugins/auth-node/src/proxy/types.ts @@ -21,7 +21,7 @@ import { ProfileTransform } from '../types'; /** @public */ export interface ProxyAuthenticator { defaultProfileTransform: ProfileTransform; - initialize(ctx: { config: Config }): Promise; + initialize(ctx: { config: Config }): TContext; authenticate( options: { req: Request }, ctx: TContext,