Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OIDC Login removes super admin role from user for no reason #57

Open
JensUweB opened this issue Jul 28, 2024 · 0 comments
Open

OIDC Login removes super admin role from user for no reason #57

JensUweB opened this issue Jul 28, 2024 · 0 comments

Comments

@JensUweB
Copy link

Hello & thanks for your work so far.
I'm currently testing your plugin with our Strapi app and I run into the following problem:

  1. Initialize new Strapi instance with a clean database and create your Super Admin user - let's say with email user1@domain.com
  2. Go to /admin & login as user1@domain.com with your choosen password. Everything works normally.
  3. Logout & Go to /strapi-plugin-sso/oidc & login with user2@domain.com.
  4. Logout, go to /admin & login as user1@domain.com again. Now your user1 lost its Super Admin role despite never been managed via the sso plugin at all.

I initialy didn't choose any role at the SSO page in the admin panel because I want to set roles for the users individually. When I choose lets say author as default role even the Super Admin user1 gets assigned the author role and loses its Super Admin role.

In my case Admins, Editors & Authors will use the same OAuth Provider (Nextcloud in my case with OIDC Plugin).

Strapi Version: 4.24.5
Node Version: 18.20.3

Plugin config:

  'strapi-plugin-sso': {
    enabled: true,
    config: {
      // Either sets token to session storage if false or local storage if true
      REMEMBER_ME: true,

      // OpenID Connect
      OIDC_REDIRECT_URI: env('API_URL') + '/strapi-plugin-sso/oidc/callback', // URI after successful login
      OIDC_CLIENT_ID: env('OIDC_CLIENT_ID'),     
      OIDC_CLIENT_SECRET: env('OIDC_CLIENT_SECRET'),
      
      OIDC_SCOPES: 'openid profile email', // https://oauth.net/2/scope/
      // API Endpoints required for OIDC
      OIDC_AUTHORIZATION_ENDPOINT: 'https://domain.cloud/index.php/apps/oidc/authorize', 
      OIDC_TOKEN_ENDPOINT: 'https://domain.cloud/index.php/apps/oidc/token',
      OIDC_USER_INFO_ENDPOINT: 'https://domain.cloud/index.php/apps/oidc/userinfo',
      OIDC_USER_INFO_ENDPOINT_WITH_AUTH_HEADER: true,
      OIDC_GRANT_TYPE: 'authorization_code', // https://oauth.net/2/grant-types/
      // customizable username arguments
      OIDC_FAMILY_NAME_FIELD: 'name',
      OIDC_GIVEN_NAME_FIELD: 'given_name', // Nextcloud doesn't have distinct first-/last name fields
    }
  }

With this behavior the plugin is basically useless for us, because just granting Super Admin role as default for everyone is obviously no option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant