add warning and prevent startup in production.

Signed-off-by: Aramis <sennyeyaramis@gmail.com>
Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
This commit is contained in:
Aramis
2024-01-27 16:59:44 -05:00
committed by aramissennyeydd
parent bb710815b2
commit d1be48bcfa
2 changed files with 6 additions and 1 deletions
@@ -2,7 +2,7 @@
This module provides a guest auth provider implementation for `@backstage/plugin-auth-backend`. This is meant to supersede the existing `'guest'` option for authentication that does not emit tokens and is completely stored as frontend state.
**NOTE**:
**NOTE**: This provider should only ever be enabled for `development` or `test`. Enabling this for production is strongly discouraged as it would give everyone a way to bypass your other authentication methods.
## Installation
@@ -30,6 +30,11 @@ export const authModuleGuestProvider = createBackendModule({
providers: authProvidersExtensionPoint,
},
async init({ providers }) {
if (process.env.NODE_ENV === 'production') {
throw new Error(
'Guest provider does not support authenticating production workloads.',
);
}
providers.registerProvider({
providerId: 'guest',
factory: createGuestAuthProviderFactory(),