Hi. I’ve set up BackOffice logins to go through our Azure application and so far it’s working well. I can authenticate, the user is created and logged in.
However, they are not granted a profile. I’d like to control this in the Azure side. So I have created roles in the app and assigned users to them. The idea being that when autolinking, I can interrogate this and get the role for the user and map it to the Umbraco role - admin, editors, product manager etc etc.
But the role is always null and there are not extra claims with role. Is there something g that needs to be added to my configuration for the extension? I’ve tried adding role to the MicrosoftAccount options, but still no luck.
I’ve tried switching to OpenId but the cookie is being truncated, so I just end up looping back to the login screen. So it looks like MicrosoftAccount is the way forward.
Thanks for the response. I did start off with AzureSSO out of the box, but it was truncating the cookie so failing authentication and I was caught in a login loop so decided to write the extension myself.
The app on Azure is setup exactly like that, but I don’t see any claims or roles returned in debug. - just the standard 5 principal claims that are defined in the MicrosoftAccount.
I’ll take another look at the source and see if I can see anything.
ps im running the latest azuresso package against azure ad, not with groups, but not seeing any issues like you’ve mentioned with truncated cookies…
(umb 17.1.0)
though, did get caught with the new multiple profiles, and the enabled flag to start with, had to fork the package and run alongside to see that simple mistake…
So, I’ve gone back to AzureSSO and built out options.Events to check hat is coming out in the MicrosoftAccountAuthenticationExtensions.cs file.
`...`
options.Events = new OpenIdConnectEvents{ OnTokenValidated = async context => { var claimsIdentity = context.Principal.Identity as System.Security.Claims.ClaimsIdentity; await System.Threading.Tasks.Task.CompletedTask; } ...
Setting a breakpoint on the claimsIdentity, I can see the claim returned including the role I am looking for. However, between this and doing the AutoLinking, it loops back to the login page and OnAutoLinking and OnExternalLogin are never hit.
So it appears as though the authentication is working as expected and the tokens returned are complete and correct, but something it the autolinking somewhere and it’s just lopping back.
We had an issue recently on one client project, where the callback responses from azure started to have a massive query strings; so much so that they where over the default query string limit and caused SSO login failures.
Upping the max query string size in Web.Config fixed the issue for us, though I have no idea why the response query strings from Azure became so large.
Note: we are not using the Azure SSO package on this project, other projects where we do use that package have not encountered this issue.