-
Notifications
You must be signed in to change notification settings - Fork 189
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
Account provisioning fails with external OIDC provider if id_token does not contain preferred_username claim. #2644
Comments
Thanks for raising this issue. I could reproduce this by deleting the I get an error on the first login / auto provisioning of a user, coming from here: ocis/accounts/pkg/service/v0/accounts.go Lines 723 to 728 in 1494e69
Which is called on the ocis/accounts/pkg/service/v0/accounts.go Lines 365 to 367 in 1494e69
I didn't get a clear understanding from the OIDC spec, if the standard claims are expected to be fully implemented or if they are only reserved... "preferred_username" also doesn't seem too important and a fallback to mail could be considered. @rhafer What's your opinion on this? @coucoulala Just out of interest, what IDP do you use? |
Thank you for your reply, I'm using Authelia. I saw #2445, but for me the authentication flow is working as expected until this issue, see also the discussion starting from authelia/authelia#2329 (comment). |
As far as I understand the spec there is no requirement to have them actually implemented.
Yeah. Ideally we'd just make PreferedName an optional attribute in the accounts service. Though I guess what will require changes elsewhere (glauth at least). Just duplicating the mail and add it as PreferedName seems possible as well, but doesn't seem like a nice solution. |
I'd be inclined to add a configuration option to define which claim has the value you're expecting if it were me. While we will probably add this upstream in Authelia at some stage I would argue generally if the id token already has the value you want, it makes sense to leverage that rather than having to get each individual OP resolved. I'd also note there are a few other IDP's that do not include this, Auth0 being one, which is part of the reason for this suggestion. |
Any progress here? |
I'm also keen on getting this working |
… claim Some IDPs (e.g. Authelia) don't add the "preferred_username" claim. Fallback to the "email" claim in that case. Fixes: owncloud#2644
I've created a small patch to fallback to "email" when "preferred_username" is not available as a quick workaround. I only did this quick workaround here as this area of the code is likely to change quite a bit in the near future an we'll need to rework it anyway. |
… claim Some IDPs (e.g. Authelia) don't add the "preferred_username" claim. Fallback to the "email" claim in that case. Fixes: owncloud#2644
Great, works as expected! 👍 |
@coucoulala I don't suppose you could confirm it that example docker-compose file you provided is actually still functioning? |
For anyone stumbling upon this: I published a full and detailed description of how to set up and configure ownCloud Infinite Scale (oCIS) OpenID Connect authentication to Authelia on my blog: |
Describe the bug
Account provisioning fails when setting
PROXY_AUTOPROVISION_ACCOUNTS
totrue
,PROXY_USER_OIDC_CLAIM
toemail
and the external OIDC provider does not supportpreferred_username
.Steps to reproduce
Steps to reproduce the behavior:
preferred_username
.id_token
and/userinfo
endpoint of external OIDC are valid.Expected behavior
According to the OIDC specifications the
preferred_username
claim in an OIDC JWT is the following:As far as I understand it,
preferred_username
is not strictly necessary. In case it is used for a human-readable username, perhaps a fallback to theemail
claim could be used.Actual behavior
Account creation fails.
Setup
I've set up the server using the following docker-compose.yml
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: