How to get Claims WSFederation cookie auth?

Viewed 142

Any unauthenticated user of my web api needs to connect to ADFS. Authentication passes. Now how do I get the userid claim from the cookie?

public IServiceProvider ConfigureServices(IServiceCollection services)
{
     services.AddMvc();

     services.AddAuthentication(o =>
     {
          o.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
          o.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
          o.DefaultChallengeScheme = WsFederationDefaults.AuthenticationScheme;
     }).AddWsFederation(o =>
     {
          o.Wtrealm = Configuration["Federation:Wtrealm"];
          o.MetadataAddress = Configuration["Federation:MetadataAddress"];
     }).AddCookie();
     return ContainerConfiguration.CreateAutofacServiceProvider(services);
}
0 Answers
Related