2

I wanted to know if anyone has tried federated authentication with Sitecore Horizon?, I have a federated environment that enables users to login with Azure AD and Horizon isn't working (it gives 500 error) which I assume since its service host it doesn't know anything about my federation providers.

More details on the stack trace:

    System.InvalidCastException: Cannot cast Newtonsoft.Json.Linq.JArray to Newtonsoft.Json.Linq.JToken.
       at Newtonsoft.Json.Linq.Extensions.Convert[T,U](T token)
       at Newtonsoft.Json.Linq.JToken.Value[T](Object key)
       at Microsoft.AspNetCore.Authentication.OpenIdConnect.Claims.UniqueJsonKeyClaimAction.Run(JObject userData, ClaimsIdentity identity, String issuer)
       at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.GetUserInformationAsync(OpenIdConnectMessage message, JwtSecurityToken jwt, ClaimsPrincipal principal, AuthenticationProperties properties)
       at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.HandleRemoteAuthenticateAsync()
    2020-03-21T17:33:58.4577714+00:00 [INF] (SerilogSample/RD501AC5CE434F) Error from RemoteAuthentication: "Cannot cast Newtonsoft.Json.Linq.JArray to Newtonsoft.Json.Linq.JToken.".
    2020-03-21T17:33:58.4598480+00:00 [ERR] (SerilogSample/RD501AC5CE434F) Connection id ""0HLU7MNJ7CENC"", Request id ""0HLU7MNJ7CENC:00000002"": An unhandled exception was thrown by the application.
    System.Exception: An error was encountered while handling the remote login. ---> System.InvalidCastException: Cannot cast Newtonsoft.Json.Linq.JArray to Newtonsoft.Json.Linq.JToken.
       at Newtonsoft.Json.Linq.Extensions.Convert[T,U](T token)
       at Newtonsoft.Json.Linq.JToken.Value[T](Object key)
       at Microsoft.AspNetCore.Authentication.OpenIdConnect.Claims.UniqueJsonKeyClaimAction.Run(JObject userData, ClaimsIdentity identity, String issuer)
       at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.GetUserInformationAsync(OpenIdConnectMessage message, JwtSecurityToken jwt, ClaimsPrincipal principal, AuthenticationProperties properties)
       at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.HandleRemoteAuthenticateAsync()
       --- End of inner exception stack trace ---
       at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()
       at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
       at Sitecore.Plugin.Authentication.ErrorHandling.AuthenticationExceptionMiddleware.Invoke(HttpContext context)
       at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.Invoke(HttpContext httpContext)
       at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
0

After debugging with the Sitecore team we found the root cause of the issue, the issue was in the below transformation since it adds the upn to the name which already has a value

<ClaimsTransformation1 type="Sitecore.Plugin.IdentityProviders.DefaultClaimsTransformation, Sitecore.Plugin.IdentityProviders"> <SourceClaims> <Claim1 type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn" /> </SourceClaims> <NewClaims> <Claim1 type="name" /> </NewClaims> </ClaimsTransformation1>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.