Merge pull request #20317 from mitchhentgesspotify/mhentges/fix-gcp-iap-refresh-500

Fix `authenticate()` ctx properties being missing
This commit is contained in:
Patrik Oldsberg
2023-10-09 16:41:39 +02:00
committed by GitHub
6 changed files with 16 additions and 6 deletions
+5
View File
@@ -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.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-auth-backend-module-gcp-iap-provider': minor
---
**BREAKING** `gcpIapAuthenticator.initialize()` is no longer `async`
@@ -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' },
}),
@@ -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;
+1 -1
View File
@@ -550,7 +550,7 @@ export interface ProxyAuthenticator<TContext, TResult> {
// (undocumented)
defaultProfileTransform: ProfileTransform<TResult>;
// (undocumented)
initialize(ctx: { config: Config }): Promise<TContext>;
initialize(ctx: { config: Config }): TContext;
}
// @public (undocumented)
+1 -1
View File
@@ -21,7 +21,7 @@ import { ProfileTransform } from '../types';
/** @public */
export interface ProxyAuthenticator<TContext, TResult> {
defaultProfileTransform: ProfileTransform<TResult>;
initialize(ctx: { config: Config }): Promise<TContext>;
initialize(ctx: { config: Config }): TContext;
authenticate(
options: { req: Request },
ctx: TContext,