auth-node: minor review fixes

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-08-11 16:54:37 +02:00
parent f5eff800fd
commit ee28fa94da
3 changed files with 19 additions and 3 deletions
@@ -17,10 +17,20 @@
export interface Config {
auth?: {
providers?: {
/**
* Configuration for the Google Cloud Platform Identity-Aware Proxy (IAP) auth provider.
*/
gcpIap?: {
[authEnv: string]: {
/**
* The audience to use when validating incoming JWT tokens.
* See https://backstage.io/docs/auth/google/gcp-iap-auth
*/
audience: string;
/**
* The name of the header to read the JWT token from, defaults to `'x-goog-iap-jwt-assertion'`.
*/
jwtHeader?: string;
};
};
@@ -45,7 +45,9 @@ export function readDeclarativeSignInResolver<TAuthResult>(
const { resolver: _ignored, ...resolverOptions } =
resolverConfig.get<JsonObject>();
return resolver(resolverOptions);
return resolver(
Object.keys(resolverOptions).length > 0 ? resolverOptions : undefined,
);
}) ?? [];
if (resolvers.length === 0) {
@@ -53,7 +55,7 @@ export function readDeclarativeSignInResolver<TAuthResult>(
}
return async (profile, context) => {
for (const resolver of resolvers ?? []) {
for (const resolver of resolvers) {
try {
return await resolver(profile, context);
} catch (error) {
+5 -1
View File
@@ -106,7 +106,7 @@ export type AuthResolverCatalogUserQuery =
};
/**
* Parameters used to issue new ID Tokens
* Parameters used to issue new Backstage Tokens
*
* @public
*/
@@ -199,6 +199,10 @@ export interface AuthProviderRouteHandlers {
* (Optional) If the auth provider supports refresh tokens then this method handles
* requests to get a new access token.
*
* Other types of providers may also use this method to implement its own logic to create new sessions
* upon request. For example, this can be used to create a new session for a provider that handles requests
* from an authenticating proxy.
*
* Request
* - to contain a refresh token cookie and scope (Optional) query parameter.
* Response