snok/django-auth-adfs

could we have USERNAME_CLAIM non-mandatory?

cusco opened this issue · 6 comments

cusco commented

Hello, thanks for the great work on this plugin.

I'm attempting to integrate with AzureAD, and our django backend has some custom pattern for usernames, that won't match anything in Azure.
We'd like to use the email field to match Azure's UPN only, being that email is unique in our backend.

Do you think this makes sense and should be changed in the plugin?

Like a mandatory setting like UPN_CLAIM_MAPPING = 'email_field'

Fund with Polar

Am I understanding you correctly that you'd like to key authentication based on the email rather than the username because the username in Django can't match what Azure would pass back?

If that's the case, would this new configuration only be usable if the setting to create users is disabled because a username can't be determined?

cusco commented

I think I'd need to be convinced that this is an issue for more folks before agreeing that it's something that should be supported out of the box. Let's see what other maintainers think.

I'm happy to help with PRs that refactor the application to make it easier for you to implement this on your end. It's clearly a real possibility, but I think I'd prefer that you maintain it in your own project (with the information and understanding I have currently).

Hmm, I'm not entirely sure I understand, so please clarify:

  • you already have the users
  • you don't want creation of new users
  • you want the user to log in through azure, but not really do anything with it, except match it towards an already existing user

?

cusco commented
cusco commented

I think I'd need to be convinced that this is an issue for more folks before agreeing that it's something that should be supported out of the box. Let's see what other maintainers think.

I'm happy to help with PRs that refactor the application to make it easier for you to implement this on your end. It's clearly a real possibility, but I think I'd prefer that you maintain it in your own project (with the information and understanding I have currently).

Thank you for your support. Tho this might not be needed by anyone else, I did create a PR with changes suiting my needs:
#264

I guess that if it were to be approved, docs would need to reflect the new setting