Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions workspaces/app-defaults/.changeset/real-coins-pick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@red-hat-developer-hub/backstage-plugin-app-auth': minor
---

Replaces the broken Guest/GitHub fallback with a descriptive ErrorPanel when auth.providers is empty or misconfigured. Removed DEFAULT_PROVIDER = 'github', auth providers need to explicitly installed dynamically. Also removed behavior when default Guest login when `auth.environment` is development.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export const signInTranslationRef: TranslationRef<
readonly 'signIn.config.missingAuthEnvironment.error': 'Missing required app configuration: auth.environment must be set';
readonly 'signIn.config.missingAuthEnvironment.panelTitle': 'Sign-in is not available';
readonly 'signIn.config.missingAuthEnvironment.description': 'Set {{ authEnvKey }} in your app configuration (for example {{ devEnv }} for local use or {{ prodEnv }} in deployed environments). Without it, the app cannot safely determine which sign-in options to offer.';
readonly 'signIn.config.noConfiguredProviders.error': 'No authentication providers are configured';
readonly 'signIn.config.noConfiguredProviders.panelTitle': 'Sign-in is not available';
readonly 'signIn.config.noConfiguredProviders.description': 'To enable sign-in, configure at least one authentication provider in your app configuration under {{ authProvidersKey }}.';
readonly 'signIn.providers.auth0.title': 'Auth0';
readonly 'signIn.providers.auth0.message': 'Sign in using Auth0';
readonly 'signIn.providers.atlassian.title': 'Atlassian';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ import {
} from '../AuthApiRefs';
import { signInTranslationRef } from '../translations/signIn';

const DEFAULT_PROVIDER = 'github';

const createProviders = (t: (key: string, params?: any) => string) =>
new Map<string, SignInProviderConfig | string>([
[
Expand Down Expand Up @@ -209,17 +207,15 @@ export function SignInPage(props: SignInPageProps): React.JSX.Element {
</ErrorPanel>
);
}
const isDevEnv = authEnvironment === 'development';

const signInPage = configApi.getOptional<string | string[]>('signInPage');
let providerNames: string[];
if (signInPage === undefined) {
const fromAuth =
providerNames =
configApi
.getOptionalConfig('auth.providers')
?.keys()
?.filter(providerId => providerId !== 'guest') ?? [];
providerNames = fromAuth.length > 0 ? fromAuth : [DEFAULT_PROVIDER];
} else {
providerNames = Array.isArray(signInPage) ? signInPage : [signInPage];
}
Expand All @@ -233,8 +229,20 @@ export function SignInPage(props: SignInPageProps): React.JSX.Element {
);

if (providerConfigs.length === 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocker — guest-only auth.providers breaks default app-defaults dev

When signInPage is omitted, keys under auth.providers are used but guest is filtered out. With only guest: {} configured (see workspaces/app-defaults/app-config.yaml), providerNames is empty and this branch shows the new ErrorPanel.

That replaces today’s dev behavior (implicit GitHub fallback + auto-prepended Guest). Please confirm intent and either:

  • restore a supported guest-dev path (e.g. inject Guest when auth.providers.guest exists and auth.environment === 'development'), or
  • update the default app-config/README/e2e so local dev is not guest-only without extra config.

Also consider a distinct message when the only configured provider is guest — the current copy points at auth.providers even though guest is already set.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocker — signInPage: guest no longer resolves

guest is not in createProviders, so signInPage: 'guest' yields an empty providerConfigs and hits this ErrorPanel. Previously, empty configs fell back to GitHub and dev prepended 'guest' to the provider list.

If guest sign-in remains supported, resolve 'guest' explicitly (Backstage accepts providers={['guest', ...]}) instead of only mapping through createProviders.

const defaultProvider = providers.get(DEFAULT_PROVIDER);
if (defaultProvider) providerConfigs.push(defaultProvider);
return (
<ErrorPanel
error={new Error(t('signIn.config.noConfiguredProviders.error'))}
title={t('signIn.config.noConfiguredProviders.panelTitle')}
>
<Typography variant="body2" component="div">
{t('signIn.config.noConfiguredProviders.description', {
replace: {
authProvidersKey: <code>auth.providers</code>,
},
})}
</Typography>
</ErrorPanel>
);
}

if (providerConfigs.some(config => typeof config === 'string')) {
Expand All @@ -244,16 +252,12 @@ export function SignInPage(props: SignInPageProps): React.JSX.Element {
return <ProxiedSignInPage {...props} provider={proxiedProvider} />;
}

const providerList = isDevEnv
? ['guest' as const, ...(providerConfigs as SignInProviderConfig[])]
: (providerConfigs as SignInProviderConfig[]);

return (
<CCSignInPage
{...props}
title={t('signIn.page.title')}
align="center"
providers={providerList}
providers={providerConfigs as SignInProviderConfig[]}
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ export const signInTranslationRef = createTranslationRef({
description:
'Set {{ authEnvKey }} in your app configuration (for example {{ devEnv }} for local use or {{ prodEnv }} in deployed environments). Without it, the app cannot safely determine which sign-in options to offer.',
},
noConfiguredProviders: {
error: 'No authentication providers are configured',
panelTitle: 'Sign-in is not available',
description:
'To enable sign-in, configure at least one authentication provider in your app configuration under {{ authProvidersKey }}.',
},
},
providers: {
auth0: {
Expand Down
Loading