I am encountering an issue where Azure AD is returning claims in a format that is unexpected. I think the difference is between version 1 and version 2 of the claims object getting returned. I have looked through the Azure portal for an app setting that deals with this and done various Innerwebs searches but can’t find an answer regarding how to return a particular version instead of another.
I am expecting to get back claims formatted similar to this :
"AuthenticationType": "Cookies",
"IsAuthenticated": true,
"Actor": null,
"BootstrapContext": null,
"Claims": [
{
"Issuer": "https://login.microsoftonline.com/xxx/v2.0",
"OriginalIssuer": "https://login.microsoftonline.com/xxx/v2.0",
"Properties": {},
"Type": "aud",
"Value": "yyy",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
}
... etc.
What I am getting is this :
{
"System.Security.ClaimsIdentity.version": "1.0",
"System.Security.ClaimsIdentity.nameClaimType": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
"System.Security.ClaimsIdentity.roleClaimType": "http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid",
"System.Security.ClaimsIdentity.claims": "Encrypted value here",
"m_userToken": {
"value": 0
}
}
Any help is greatly appreciated.
2
Answers
This turned out to be a data integrity issue. Our customer's Azure AD client id was entered with a trailing space. The neither the web app nor Azure trims the string. Once the trailing space was removed everything works as expected.
You may have to change the accessTokenAcceptedVersion part of the
manifest to 2
if you want a V2 access token. If its value is null or 1, that means your app will only accept the v1 token.But please note that scopes for microsoft graph api , always returns version 1 tokens.
The v2 authorization endpoint is
https://login.microsoftonline.com/tenantid/oauth2/v2.0/authorize
andv2 token endpoint is
https://login.microsoftonline.com/tenantid/oauth2/v2.0/token
wheere as the v1 authorization endpoint is like:
https://login.microsoftonline.com/tenantid/oauth2/authorize?
and v1 token endpoint:
https://login.microsoftonline.com/tenantid/oauth2/token
References: