PR Feedback

Signed-off-by: Alex Crome <afscrome@users.noreply.github.com>
This commit is contained in:
Alex Crome
2023-02-14 14:50:37 +00:00
parent aa721158d1
commit b84349e2f6
4 changed files with 9 additions and 19 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
---
'@backstage/plugin-auth-backend': minor
'@backstage/plugin-auth-backend': patch
---
Added authentication provider for Azure Easy Authentication.
+3 -3
View File
@@ -19,7 +19,7 @@ export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
const authProviderFactories = {
'azure-easyAuth': providers.easyAuth.create({
'azure-easyauth': providers.easyAuth.create({
signIn: {
resolver: async (info, ctx) => {
const {
@@ -52,7 +52,7 @@ export default async function createPlugin(
```
Now the backend is ready to serve auth requests on the
`/api/auth/azure-easyAuth/refresh` endpoint. All that's left is to update the frontend
`/api/auth/azure-easyauth/refresh` endpoint. All that's left is to update the frontend
sign-in mechanism to poll that endpoint through the IAP, on the user's behalf.
## Frontend Changes
@@ -65,7 +65,7 @@ installed in `packages/app/src/App.tsx` like this:
const app = createApp({
components: {
+ SignInPage: props => <ProxiedSignInPage {...props} provider="azure-easyAuth" />,
+ SignInPage: props => <ProxiedSignInPage {...props} provider="azure-easyauth" />,
```
See the [Sign-In with Proxy Providers](../index.md#sign-in-with-proxy-providers) section for more information.
@@ -256,7 +256,7 @@ describe('easyAuth factory', () => {
});
expect(() => factory({} as any)).toThrow(
'Authentication provider is not Azure Active Directory',
'Authentication provider is not Azure Active Directory',
);
});
@@ -178,25 +178,15 @@ function validateAppServiceConfiguration(env: NodeJS.ProcessEnv) {
if (env.WEBSITE_SKU === undefined) {
throw new Error('Backstage is not running on Azure App Services');
}
if (!isEqualCaseInsensitive(env.WEBSITE_AUTH_ENABLED, 'True')) {
if (env.WEBSITE_AUTH_ENABLED?.toLowerCase() !== 'true') {
throw new Error('Azure App Services does not have authentication enabled');
}
if (
!isEqualCaseInsensitive(
env.WEBSITE_AUTH_DEFAULT_PROVIDER,
'AzureActiveDirectory',
)
env.WEBSITE_AUTH_DEFAULT_PROVIDER?.toLowerCase() !== 'azureactivedirectory'
) {
throw new Error('Authentication provider is not Azure Active Directory');
throw new Error('Authentication provider is not Azure Active Directory');
}
if (!isEqualCaseInsensitive(process.env.WEBSITE_AUTH_TOKEN_STORE, 'True')) {
if (process.env.WEBSITE_AUTH_TOKEN_STORE?.toLowerCase() !== 'true') {
throw new Error('Token Store is not enabled');
}
}
function isEqualCaseInsensitive(left: string | undefined, right: string) {
return (
left !== undefined &&
right.localeCompare(left, undefined, { sensitivity: 'base' }) === 0
);
}