Skip to content
Open
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
17 changes: 12 additions & 5 deletions plugins/backstage-plugin-backend/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CatalogFetchApi {
constructor(
private readonly logger: LoggerService,
private readonly auth: AuthService,
) {}
) { }

async fetch(
input: unknown,
Expand Down Expand Up @@ -62,10 +62,17 @@ export const pagerDutyPlugin = createBackendPlugin({
}),
}),
);
httpRouter.addAuthPolicy({
path: '/',
allow: 'unauthenticated',
});
// The default Backstage behaviour is to require authentication on routes.
// https://backstage.io/docs/backend-system/core-services/http-router/#using-the-service
// Setting disableUnauthenticatedAccess to true will revert this plugin's route authentication
// policy back to the default Backstage behaviour.
const disableUnauthenticatedAccess = config.getOptionalBoolean('pagerDuty.disableUnauthenticatedAccess') ?? false;
if (!disableUnauthenticatedAccess) {
httpRouter.addAuthPolicy({
path: '/',
allow: 'unauthenticated',
});
}
},
});
},
Expand Down