mozilla / mozilla-django-oidc

A django OpenID Connect library
https://mozilla-django-oidc.readthedocs.io
Mozilla Public License 2.0
444 stars 166 forks source link

PR for alternate unique identifier setting (`OIDC_OP_UNIQUE_IDENTIFIER` instead of email)? #523

Closed lbeaufort closed 3 months ago

lbeaufort commented 6 months ago

Hi there!

Thank you for providing this helpful package!

We've been working off a forked copy of your package so we can implement the private_key_jwt client authentication method for login.gov.

One other change we made on our end was to swap out email for a new OIDC_OP_UNIQUE_IDENTIFIER setting, so we could use login.gov's UUID, which persists when login.gov users update their email address associated with their login.gov account. Would adding a PR for a new unique identifier setting be welcome? I'd be happy to include test coverage and documentation, etc.

Thanks for considering, and please let me know if you have any questions!

Laura Beaufort Technical Lead Federal Election Commission fec.gov

lbeaufort commented 3 months ago

After reviewing the docs more carefully, I think we can handle everything we need for custom unique identifiers by subclassing the mozilla_django_oidc.auth.OIDCAuthenticationBackend class, apologies for the chatter. I'll focus on a PR for #457.

https://mozilla-django-oidc.readthedocs.io/en/stable/installation.html#connecting-oidc-user-identities-to-django-users https://mozilla-django-oidc.readthedocs.io/en/stable/installation.html?highlight=create_user#changing-how-django-users-are-created