From a0ef1ec7349f998ac259d7efb265193796dbccbe Mon Sep 17 00:00:00 2001 From: Alex Crome Date: Mon, 27 Mar 2023 00:10:53 +0100 Subject: [PATCH 1/4] Properly expose easy auth provider 16108 added support for Azure easy auth, however the provider wasn't properly exposed so it can't be used. This PR fixes that by properly exposing the provider Signed-off-by: Alex Crome --- .changeset/sour-laws-walk.md | 5 +++++ plugins/auth-backend/src/providers/providers.ts | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 .changeset/sour-laws-walk.md diff --git a/.changeset/sour-laws-walk.md b/.changeset/sour-laws-walk.md new file mode 100644 index 0000000000..073e3dc6a8 --- /dev/null +++ b/.changeset/sour-laws-walk.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-auth-backend': patch +--- + +Export Azure Easy Auth provider so it can actually be used. diff --git a/plugins/auth-backend/src/providers/providers.ts b/plugins/auth-backend/src/providers/providers.ts index aa630b7481..36a24f4f6c 100644 --- a/plugins/auth-backend/src/providers/providers.ts +++ b/plugins/auth-backend/src/providers/providers.ts @@ -32,6 +32,7 @@ import { onelogin } from './onelogin'; import { saml } from './saml'; import { AuthProviderFactory } from './types'; import { bitbucketServer } from './bitbucketServer'; +import { easyAuth } from './azure-easyauth'; /** * All built-in auth provider integrations. @@ -56,6 +57,7 @@ export const providers = Object.freeze({ okta, onelogin, saml, + easyAuth, }); /** @@ -73,6 +75,7 @@ export const defaultAuthProviderFactories: { okta: okta.create(), auth0: auth0.create(), microsoft: microsoft.create(), + easyAuth: easyAuth.create(), oauth2: oauth2.create(), oidc: oidc.create(), onelogin: onelogin.create(), From 7019734333a0758b34c4c4a68b051fbad2a1afa6 Mon Sep 17 00:00:00 2001 From: Alex Crome Date: Mon, 27 Mar 2023 00:53:19 +0100 Subject: [PATCH 2/4] Fix Api Report Signed-off-by: Alex Crome --- plugins/auth-backend/api-report.md | 19 +++++++++++++++++++ .../src/providers/azure-easyauth/index.ts | 2 +- .../src/providers/azure-easyauth/provider.ts | 1 + plugins/auth-backend/src/providers/index.ts | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/plugins/auth-backend/api-report.md b/plugins/auth-backend/api-report.md index 7515083c09..81d6512155 100644 --- a/plugins/auth-backend/api-report.md +++ b/plugins/auth-backend/api-report.md @@ -229,6 +229,12 @@ export const defaultAuthProviderFactories: { [providerId: string]: AuthProviderFactory; }; +// @public (undocumented) +export type EasyAuthResult = { + fullProfile: Profile; + accessToken?: string; +}; + // @public (undocumented) export const encodeState: (state: OAuthState) => string; @@ -694,6 +700,19 @@ export const providers: Readonly<{ nameIdMatchingUserEntityName(): SignInResolver; }>; }>; + easyAuth: Readonly<{ + create: ( + options?: + | { + authHandler?: AuthHandler | undefined; + signIn: { + resolver: SignInResolver; + }; + } + | undefined, + ) => AuthProviderFactory; + resolvers: never; + }>; }>; // @public (undocumented) diff --git a/plugins/auth-backend/src/providers/azure-easyauth/index.ts b/plugins/auth-backend/src/providers/azure-easyauth/index.ts index 698092d73f..73abde5f37 100644 --- a/plugins/auth-backend/src/providers/azure-easyauth/index.ts +++ b/plugins/auth-backend/src/providers/azure-easyauth/index.ts @@ -15,4 +15,4 @@ */ export { easyAuth } from './provider'; -export type { EasyAuthResponse } from './provider'; +export type { EasyAuthResult } from './provider'; diff --git a/plugins/auth-backend/src/providers/azure-easyauth/provider.ts b/plugins/auth-backend/src/providers/azure-easyauth/provider.ts index 405ca9ed59..7da069f6ae 100644 --- a/plugins/auth-backend/src/providers/azure-easyauth/provider.ts +++ b/plugins/auth-backend/src/providers/azure-easyauth/provider.ts @@ -38,6 +38,7 @@ type Options = { resolverContext: AuthResolverContext; }; +/** @public */ export type EasyAuthResult = { fullProfile: Profile; accessToken?: string; diff --git a/plugins/auth-backend/src/providers/index.ts b/plugins/auth-backend/src/providers/index.ts index a922065fd8..8173a7fbc3 100644 --- a/plugins/auth-backend/src/providers/index.ts +++ b/plugins/auth-backend/src/providers/index.ts @@ -15,6 +15,7 @@ */ export type { AwsAlbResult } from './aws-alb'; +export type { EasyAuthResult } from './azure-easyauth'; export type { BitbucketOAuthResult, BitbucketPassportProfile, From 7974080aba537841f8fcbc829ca07fda7ef79467 Mon Sep 17 00:00:00 2001 From: Alex Crome Date: Mon, 27 Mar 2023 00:54:13 +0100 Subject: [PATCH 3/4] Add easy auth to documentation navigation. Also corrected entries so they show up in alphabetical order in the sidebar. Signed-off-by: Alex Crome --- microsite/sidebars.json | 7 ++++--- mkdocs.yml | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/microsite/sidebars.json b/microsite/sidebars.json index 09727685a0..412813263c 100644 --- a/microsite/sidebars.json +++ b/microsite/sidebars.json @@ -277,15 +277,16 @@ "items": [ "auth/auth0/provider", "auth/atlassian/provider", - "auth/bitbucket/provider", "auth/microsoft/provider", + "auth/microsoft/easyauth", + "auth/bitbucket/provider", "auth/github/provider", "auth/gitlab/provider", "auth/google/provider", "auth/google/gcp-iap-auth", "auth/okta/provider", - "auth/onelogin/provider", - "auth/oauth2-proxy/provider" + "auth/oauth2-proxy/provider", + "auth/onelogin/provider" ] }, "auth/identity-resolver", diff --git a/mkdocs.yml b/mkdocs.yml index 4b5c2cf7a2..4a75c3f67f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -6,6 +6,7 @@ edit_uri: edit/master/docs plugins: - techdocs-core +# For sidebar navigation on https://backstage.io/, see `microsite/sidebars.json` nav: - Overview: - What is Backstage?: 'overview/what-is-backstage.md' From 76453d497e56a091c455a31d93e6e189d5f4f2ac Mon Sep 17 00:00:00 2001 From: Alex Crome Date: Tue, 4 Apr 2023 20:31:27 +0100 Subject: [PATCH 4/4] Fixed sidebar issues Updated easy auth document preamble to better match other auth providers. Signed-off-by: Alex Crome --- docs/auth/microsoft/azure-easyauth.md | 6 ++++-- microsite/sidebars.json | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/auth/microsoft/azure-easyauth.md b/docs/auth/microsoft/azure-easyauth.md index 4daf0851f0..8ea626288c 100644 --- a/docs/auth/microsoft/azure-easyauth.md +++ b/docs/auth/microsoft/azure-easyauth.md @@ -1,10 +1,12 @@ --- -id: azure-easy-auth +id: easy-auth title: Azure EasyAuth Provider -sidebar_label: Azure EasyAuth +sidebar_label: Azure Easy Auth description: Adding Azure's EasyAuth Proxy as an authentication provider in Backstage --- +The Backstage `core-plugin-api` package comes with a Microsoft authentication provider that can authenticate users using Azure Active Directory for PaaS service hosted in Azure that support Easy Auth, such as Azure App Services. + ## Backstage Changes Add the following into your `app-config.yaml` or `app-config.production.yaml` file diff --git a/microsite/sidebars.json b/microsite/sidebars.json index 412813263c..b3e6f07b0e 100644 --- a/microsite/sidebars.json +++ b/microsite/sidebars.json @@ -278,7 +278,7 @@ "auth/auth0/provider", "auth/atlassian/provider", "auth/microsoft/provider", - "auth/microsoft/easyauth", + "auth/microsoft/easy-auth", "auth/bitbucket/provider", "auth/github/provider", "auth/gitlab/provider",