Apicurio / apicurio-registry

An API/Schema registry - stores APIs and Schemas.
https://www.apicur.io/registry/
Apache License 2.0
605 stars 267 forks source link

CORS error when logging with Microsoft #4853

Closed krystofrezac closed 1 month ago

krystofrezac commented 4 months ago

Description

Registry Version: 2.6.0.Final Persistence type: sql

When logging with Microsoft I get this error and get stuck on white screen.

Screenshot 2024-07-04 at 14 01 48

I am able to log in with this plugin enabled: https://chromewebstore.google.com/detail/cors-unblock/lfhmikememgdcahcdlaciloancbhjino

Environment

config env variables:

REGISTRY_AUTH_ANONYMOUS_READ_ACCESS_ENABLED: "true"
REGISTRY_AUTH_ENABLED: "true"
REGISTRY_UI_AUTH_TYPE: oidc
KEYCLOAK_API_CLIENT_ID: xxx
REGISTRY_OIDC_UI_CLIENT_ID: xxx
REGISTRY_AUTH_URL_CONFIGURED: https://login.microsoftonline.com/xxx
REGISTRY_OIDC_UI_REDIRECT_URL: xxx
ROLE_BASED_AUTHZ_ENABLED: "true"
QUARKUS_OIDC_ROLES_ROLE_CLAIM_PATH: roles
CORS_ALLOWED_ORIGINS: "*"

Steps to Reproduce

  1. Go to the ui
  2. Login with Microsoft
  3. Check the console

Expected vs Actual Behaviour

The expected behaviour is to login without any problem.

Possible fix

It works with this patch applied on tag 2.6.0.Final . But I am not sure if it will break some other functionality

diff --git a/ui/src/services/auth/auth.service.ts b/ui/src/services/auth/auth.service.ts
index 3446461dc..96da207cd 100644
--- a/ui/src/services/auth/auth.service.ts
+++ b/ui/src/services/auth/auth.service.ts
@@ -128,7 +128,7 @@ export class AuthService implements Service {
             response_type: "code",
             scope: "openid profile email",
             filterProtocolClaims: true,
-            loadUserInfo: true
+            // loadUserInfo: true
         };
     }
carlesarnal commented 1 month ago

In this context the request is being blocked by ENTRA ID, not by Registry, it's very likely a misconfiguration there. If you follow the blog we have you must be able to log in without any problems.

krystofrezac commented 1 month ago

Yeah, you're right. It was misconfigured. I missed the v2.0 at the end of REGISTRY_AUTH_URL_CONFIGURED