-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Backoffice login with Azure Ad broken after upgrade (13.5.1 to 13.5.2) #17383
Comments
Hi there @Oxygen-cl! Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better. We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.
We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
After some testing, I can see that this commit was the smoking gun: If this code is commented out, the external login works again. |
After some investigation, I found that the issue lies in the GetId method in Umbraco.Extensions.ClaimsIdentityExtensions. The identity, after the external login from Entra ID, already contains a NameIdentifier claim. The format of this claim is not an integer; therefore, int.Parse will throw an error. I tried changing int.Parse to int.TryParse. This fixed the error, but I don’t know if this could cause other issues with providers other than Entra ID. I’ll make a pull request with this fix. |
Hi @Oxygen-cl I've been looking into this, but unfortunately, I cannot reproduce it using Azure B2C and OpenIdConnect, I'm assuming that's what you're using? The whole flow is pretty convoluted but this is what I've tracked down:
So while in theory I agree that it's not a bad idea to use a TryParse, it doesn't really seem to fix the underlying issue, I'm very curious how you ended up hitting that specific code with the |
Also, just to clarify so I'm not barking up the wrong tree, are we talking backoffice users, or members? |
Yes, the error is occurring for Backoffice users. In the latest update (13.5.2), the following code was added to
I’ve noticed that when we return from Entra, this is one of the first things that gets called. While reviewing the pull request, I observed that this commit has not been merged into the v13/contrib branch. If you're using that branch for testing, the error will not appear. Let me know if you need further clarification. This is the code we are using to implement the login:
|
Thanks for adding the sample code, that helped a ton 😄. I've had another look at this and this is what I've found. What happens is that your code calls What this does is adding all the claims required to be an This meant that later, when When all that is said, I actually still think your PR makes sense, it should be a TryParse after all, however I'd recommend removing the |
And a big thank you for both the investigation and the PR! 🎉 H5YR 😄 |
I've gone ahead and merged #17414 so I'll close this issue 😄 |
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
13.5.2
Bug summary
After applying the security upgrade to 13.5.2 the users get an error on login with Azure AD.
We testet on 2 different solutions getting the same error.
We implemented the login using the guide from the docs: https://docs.umbraco.com/umbraco-cms/13.latest-lts/reference/security/external-login-providers
We get this error after login:
Specifics
No response
Steps to reproduce
Login using Azure AD (Entra ID)
The error shows.
Expected result / actual result
No response
This item has been added to our backlog AB#45472
The text was updated successfully, but these errors were encountered: