I've created a azure login like discriped here: https://labs.tadigital.com/index.php/2018/02/16/integrating-federated-authentication-for-sitecore-9-with-azure-ad/
I am using Sitecore 9 Update 2.
the authentication works I think, because I got logged in. But I am using this transformation like descriped in the post to asign the current logged in user to the developer role
<transformation name="devRole" type="Sitecore.Owin.Authentication.Services.DefaultTransformation, Sitecore.Owin.Authentication">
<sources hint="raw:AddSource">
<claim name="groups" value="99c44f22-e2e2-4d2d-af90-3ccb0fb3b234" />
</sources>
<targets hint="raw:AddTarget">
<claim name="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" value="sitecore\Developer" />
</targets>
<keepSource>true</keepSource>
</transformation>
but I am not assigned to any role and my username is just some random string
I was hopeing that this config section would take care about my username mapping, but that seems not to work.
<propertyInitializer type="Sitecore.Owin.Authentication.Services.PropertyInitializer, Sitecore.Owin.Authentication">
<maps hint="list">
<map name="email claim" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication">
<data hint="raw:AddData">
<!--claim name-->
<source name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" />
<!--property name-->
<target name="Email" />
</data>
</map>
<map name="Name claim" type="Sitecore.Owin.Authentication.Services.DefaultClaimToPropertyMapper, Sitecore.Owin.Authentication">
<data hint="raw:AddData">
<!--claim name-->
<source name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" />
<!--property name-->
<target name="Name" />
</data>
</map>
</maps>
</propertyInitializer>
here is my Processing function for the backend
protected override void ProcessCore(IdentityProvidersArgs args)
{
Assert.ArgumentNotNull(args, nameof(args));
var identityProvider = this.GetIdentityProvider();
var authenticationType = this.GetAuthenticationType();
string aadInstance = Settings.GetSetting("AADInstance");
string tenant = Settings.GetSetting("Tenant");
string clientId = Settings.GetSetting("ClientId");
string postLogoutRedirectURI = Settings.GetSetting("PostLogoutRedirectURI");
string redirectURI = Settings.GetSetting("RedirectURI");
string authority = string.Format(CultureInfo.InvariantCulture, aadInstance, tenant);
Log.Info($"AD Auth Login Start", "adAuth");
args.App.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
Caption = identityProvider.Caption,
AuthenticationType = authenticationType,
AuthenticationMode = AuthenticationMode.Passive,
ClientId = clientId,
Authority = authority,
PostLogoutRedirectUri = postLogoutRedirectURI,
RedirectUri = redirectURI,
Notifications = new OpenIdConnectAuthenticationNotifications
{
SecurityTokenValidated = notification =>
{
var identity = notification.AuthenticationTicket.Identity;
foreach (var claimTransformationService in identityProvider.Transformations)
{
claimTransformationService.Transform(identity, new TransformationContext(FederatedAuthenticationConfiguration, identityProvider));
}
notification.AuthenticationTicket = new AuthenticationTicket(identity, notification.AuthenticationTicket.Properties);
Log.Info($"AD AuthenticationTicket erstellt", "adAuth");
return Task.FromResult(0);
}
}
});
}
Here the slightly modified claim object I get from Azure
"Claims": [
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {},
"Type": "aud",
"Value": "5dc10a7b-a961-458a-8560-1d55cb8943e4",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {},
"Type": "iss",
"Value": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {
"http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/json_type": "System.Int32"
},
"Type": "iat",
"Value": "1554181283",
"ValueType": "JSON"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {
"http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/json_type": "System.Int32"
},
"Type": "nbf",
"Value": "1554181283",
"ValueType": "JSON"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {
"http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/json_type": "System.Int32"
},
"Type": "exp",
"Value": "1554185183",
"ValueType": "JSON"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {},
"Type": "aio",
"Value": "ASQA2/8KAAAAxWvJNuWVxgVmSFH2Tut1C3Co5y5bl1sAifCP6qRT+rA=",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {
"http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/ShortTypeName": "amr"
},
"Type": "http://schemas.microsoft.com/claims/authnmethodsreferences",
"Value": "pwd",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {},
"Type": "c_hash",
"Value": "HmxzxzxNfpnt3vKkL1t0zg",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {
"http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/ShortTypeName": "family_name"
},
"Type": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname",
"Value": "Blubb",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {
"http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/ShortTypeName": "given_name"
},
"Type": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname",
"Value": "Johannes",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {},
"Type": "groups",
"Value": "09c44f22-e2e2-4d2d-af90-3ccb0fb3b234",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {},
"Type": "ipaddr",
"Value": "15.15.85.212",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {},
"Type": "name",
"Value": "Blubb, Johannes - Test",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {},
"Type": "nonce",
"Value": "636897783827121098.NjMxZjhlYWYtMTQ4YS00YTlhLWJkMDgtMjgyNTdiYWMwM2UyY2QzOGYzYWMtYmIyOC00MzI2LTg4ZjktNDMzYzgzNDY1MWIy",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {
"http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/ShortTypeName": "oid"
},
"Type": "http://schemas.microsoft.com/identity/claims/objectidentifier",
"Value": "7edc78ef-6666-6672-97d5-d8f643d6b47e",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {},
"Type": "onprem_sid",
"Value": "S-1-5-21-1456952878-1040323209-000000000-6677",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {
"http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/ShortTypeName": "sub"
},
"Type": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier",
"Value": "AnEOzDgyzeS4VcBNdElrZ2i_-BaW1HfABM_GK_DbMME",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {
"http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/ShortTypeName": "tid"
},
"Type": "http://schemas.microsoft.com/identity/claims/tenantid",
"Value": "b076d2cb-aaaa-4977-aaaa-18266dbcf8f0",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {
"http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/ShortTypeName": "unique_name"
},
"Type": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
"Value": "[email protected]",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {
"http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/ShortTypeName": "upn"
},
"Type": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn",
"Value": "[email protected]",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {},
"Type": "uti",
"Value": "uXQBhCnoFUCybAGqyjBBBB",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
},
{
"Issuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"OriginalIssuer": "https://sts.windows.net/b076d2cb-aaaa-4977-aaaa-18266dbcf8f0/",
"Properties": {},
"Type": "ver",
"Value": "1.0",
"ValueType": "http://www.w3.org/2001/XMLSchema#string"
}
],
I think I've some lack of understanging what is going on here or I what I am missing?