chore: fix tests and add changeset

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2024-02-21 12:44:45 +01:00
parent 9b810b9a99
commit b1b012d065
5 changed files with 30 additions and 4 deletions
+8
View File
@@ -0,0 +1,8 @@
---
'@backstage/plugin-auth-backend-module-oauth2-proxy-provider': patch
'@backstage/plugin-auth-backend-module-aws-alb-provider': patch
'@backstage/plugin-auth-backend-module-gcp-iap-provider': patch
'@backstage/plugin-auth-node': patch
---
Fix issue with `providerInfo` not being set properly for some auth providers, by making `providerInfo` an explicit optional return from `authenticate`
@@ -107,6 +107,10 @@ describe('AwsAlbProvider', () => {
expiresInSeconds: mockClaims.exp,
accessToken: mockAccessToken,
},
providerInfo: {
accessToken: mockAccessToken,
expiresInSeconds: mockClaims.exp,
},
});
});
});
@@ -45,7 +45,10 @@ describe('GcpIapProvider', () => {
},
ctx,
),
).resolves.toEqual({ result: { iapToken: { sub: 's', email: 'e' } } });
).resolves.toEqual({
result: { iapToken: { sub: 's', email: 'e' } },
providerInfo: { iapToken: { sub: 's', email: 'e' } },
});
});
it('should find custom JWT header', async () => {
@@ -66,7 +69,10 @@ describe('GcpIapProvider', () => {
},
ctx,
),
).resolves.toEqual({ result: { iapToken: { sub: 's', email: 'e' } } });
).resolves.toEqual({
result: { iapToken: { sub: 's', email: 'e' } },
providerInfo: { iapToken: { sub: 's', email: 'e' } },
});
});
it('should throw if header is missing', async () => {
+5 -1
View File
@@ -538,7 +538,11 @@ export type ProfileTransform<TResult> = (
}>;
// @public (undocumented)
export interface ProxyAuthenticator<TContext, TResult, TProviderInfo> {
export interface ProxyAuthenticator<
TContext,
TResult,
TProviderInfo = undefined,
> {
// (undocumented)
authenticate(
options: {
+5 -1
View File
@@ -19,7 +19,11 @@ import { Request } from 'express';
import { ProfileTransform } from '../types';
/** @public */
export interface ProxyAuthenticator<TContext, TResult, TProviderInfo> {
export interface ProxyAuthenticator<
TContext,
TResult,
TProviderInfo = undefined,
> {
defaultProfileTransform: ProfileTransform<TResult>;
initialize(ctx: { config: Config }): TContext;
authenticate(