Skip to content

[Bug]: OIDC_USERNAME_ATTRIBUTE variable seems to be ignored #1359

@haukebruno

Description

@haukebruno

Where is the problem occurring?

I encountered the problem while interacting with the server (Backend)

What browsers are you seeing the problem on?

No response

Current behavior

While setting both env variables OIDC_USERNAME_ATTRIBUTE and OIDC_IGNORE_USERNAME=false the usernames of users synced from an IdP (Authentik in my case) aren't set on the user objects in the Planka database.

I tried a flat attribute like OIDC_USERNAME_ATTRIBUTE=foo and also a nested one like OIDC_USERNAME_ATTRIBUTE=attributes.custom_username.

Login still works, the users will be created but without the username.

I guess this isn't a problem at all while using Planka, but I'm still curious whether it is possible to sync also custom usernames from an IdP attribute to the Planka DB.

The default attribute preferred_username works like a charm, only custom ones don't.

Also logs don't point out anything (neither on the Planka nor on the IdP side).

Desired behavior

While having OIDC_IGNORE_USERNAME=false and OIDC_USERNAME_ATTRIBUTE=attributes.custom_username set and having something like "attributes" : { "custom_username" : "foo" } in the JWT payload, I'd expect to see the DB column username in the user_account table set to foo

Steps to reproduce

  • Set OIDC_IGNORE_USERNAME=false as env variable
  • Set OIDC_USERNAME_ATTRIBUTE=attributes.custom_username as env variable
  • Check that JWT payload of Authentik contains "attributes" : { "custom_username" : "foo" }
  • Perform Planka SSO login
  • Perform select id, email, updated_at,username from user_account; on the Planka DB

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions