0

I am trying to configure the OpenIdConnectOptions and OAuthOptions in order to solve an issue where custom claims are not mapped to the cookie. I'm running the ASP.NET Core 3.0 Preview 5 react SPA template. Basically, the gist of the Identity configuration looks like this:

services.AddDefaultIdentity<ApplicationUser>()
    .AddEntityFrameworkStores<ApplicationDbContext>();

services.AddIdentityServer()
    .AddApiAuthorization<ApplicationUser, ApplicationDbContext>();

services.AddAuthentication()
   .AddIdentityServerJwt();

services.Configure<IdentityOptions>(options => {
   // These options are set
});

services.Configure<OpenIdConnectOptions>(options => { 
   // These are not set
   options.ClaimActions.MapUniqueJsonKey("MyCustomClaim", "MyCustomClaim");
   options.GetClaimsFromUserInfoEndpoint = true;
});

services.Configure<OAuthOptions>(options => {
   // Neither are these
   options.ClaimActions.MapUniqueJsonKey("MyCustomClaim", "MyCustomClaim");
});

Now, from the logs I can verify that services.Configure<IdentityOptions> is executed, but neither services.Configure<OpenIdConnectOptions> nor services.Configure<OAuthOptions> are executed at all. I was under the impression that Identity server basically is an OpenIdConnect implementation on top of an OAuth-server. So why is it that these services aren't used? How can I set these options for the Identity server?

conciliator
  • 6,078
  • 6
  • 41
  • 66
  • What are you trying to do? If you’re trying to add a federated identity provider then add a new authentication handler with the correctly configured OpenIdConnectOptions? – Randy Jun 10 '19 at 00:38
  • @Randy sorry if that wasn't clear from my question. Basically I wanted to know how to set the `OpenIdConnectOptions` so that my claims got added to the access token provided by the server. In the end I solved the issue by using an IProfileService-implementation instead, so I haven't investigated this issue any further. – conciliator Jun 10 '19 at 17:21

0 Answers0