django-keycloak icon indicating copy to clipboard operation
django-keycloak copied to clipboard

Set username as Keycloak Username (instead of Keycloak ID)

Open srinathganesh1 opened this issue 5 years ago • 7 comments

This is what my keycloak User Screen looks like Screenshot from 2020-03-29 22-25-10

BUT when I log within django,

  • user.email is proper (whats present in keycloak)
  • user.username is getting set as ID from keycloak.

Is there a way to retain djnago username as keycloak username?

srinathganesh1 avatar Mar 29 '20 16:03 srinathganesh1

I am getting django_keycloak.auth.bacjends dose not have define a BaseKeycloakMiddleware attribute/class

nirav3650 avatar Mar 30 '20 06:03 nirav3650

Hi nirav, if you could start a different issue/thread with your configuration files, then i could see how i could help

On Mon, 30 Mar, 2020, 12:00 Nirav Kakkad, [email protected] wrote:

Hi Shrikant, I am trying to use django_keycloak but I am not able to authenticate the users. I followed the tutorial till initial setup, can you please help me with the initial setup of the project

srinathganesh1 avatar Mar 30 '20 07:03 srinathganesh1

Hi Shrinath, I am trying to use django_keycloak but I am not able to authenticate the users. I followed the tutorial till initial setup, can you please help me with the initial setup of the project Hi nirav,

I would not be ready to mix up others issues within this issue post, if you could start a different issue/thread with your configuration files, then i could see how i could help

srinathganesh1 avatar Mar 30 '20 07:03 srinathganesh1

Why does the plugin not use preferred_username that is being returned by Keycloak?

Screenshot from 2020-04-02 01-53-34

srinathganesh1 avatar Apr 01 '20 20:04 srinathganesh1

I get user id of the authenticated keycloak user in Django instead of username when I use request.user.username

Does preferred username give us the username of the user specified in keycloak of that user?

nirav3650 avatar Apr 02 '20 10:04 nirav3650

I get user id of the authenticated keycloak user in Django instead of username when I use request.user.username

Does preferred username give us the username of the user specified in keycloak of that user?

prefered_username of oauth does return username, but this plugin does not seem to be reading it

srinathganesh1 avatar Apr 02 '20 11:04 srinathganesh1

Why does the plugin not use preferred_username that is being returned by Keycloak?

Screenshot from 2020-04-02 01-53-34

Update: I locally changed it to preferred_username and did python3 setup.py install and logged in. Things seems to work fine and keycloak Username is getting populated to user.username

Still awaiting more testing, but basic run looks good

srinathganesh1 avatar Apr 02 '20 12:04 srinathganesh1