From c0057777c1563717b28b1a0b9b111a5b21722abd Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Sat, 21 Sep 2024 03:25:41 +0530 Subject: [PATCH 1/2] Ensure resolvers are not added in app config during custom sign in resolvers Signed-off-by: Himanshu Mishra --- docs/auth/identity-resolver.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/docs/auth/identity-resolver.md b/docs/auth/identity-resolver.md index dbebf3056c..cdcd7b504d 100644 --- a/docs/auth/identity-resolver.md +++ b/docs/auth/identity-resolver.md @@ -142,8 +142,28 @@ backend.add(import('@backstage/plugin-auth-backend-module-github-provider')); When you want to supply a custom sign-in resolver, as a general pattern you remove that last import and instead construct your own provider using the -facilities from the same package. You can leave the config unchanged from -before. +facilities from the same package. + +Make sure that your `auth` config in your `app-config.yaml` does not contain +any `resolvers` field. + +```yaml title="in e.g. app-config.yaml" +auth: + environment: development + providers: + github: + development: + clientId: ${AUTH_GITHUB_CLIENT_ID} + clientSecret: ${AUTH_GITHUB_CLIENT_SECRET} + enterpriseInstanceUrl: ${AUTH_GITHUB_ENTERPRISE_INSTANCE_URL} +/* highlight-remove-start */ + signIn: + resolvers: + - resolver: usernameMatchingUserEntityName + - resolver: emailMatchingUserEntityProfileEmail + - resolver: emailLocalPartMatchingUserEntityName +/* highlight-remove-end */ +``` ```ts title="in packages/backend/src/index.ts" /* highlight-add-start */ From 8aa1f8715714e96065ab36c20035767e0b8bd50e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Sat, 21 Sep 2024 08:26:46 +0200 Subject: [PATCH 2/2] Update docs/auth/identity-resolver.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- docs/auth/identity-resolver.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/auth/identity-resolver.md b/docs/auth/identity-resolver.md index cdcd7b504d..d6b377d990 100644 --- a/docs/auth/identity-resolver.md +++ b/docs/auth/identity-resolver.md @@ -145,7 +145,7 @@ remove that last import and instead construct your own provider using the facilities from the same package. Make sure that your `auth` config in your `app-config.yaml` does not contain -any `resolvers` field. +any `resolvers` field - otherwise, they take priority. ```yaml title="in e.g. app-config.yaml" auth: