When I call AddOpenIdConnect(), I get an exception:
An unhandled exception occurred while processing the request. TypeLoadException: Could not load type 'Microsoft.AspNetCore.Authentication.RequestPathBaseCookieBuilder' from assembly 'Microsoft.AspNetCore.Authentication, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectOptions..ctor()
Example Code:
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
var builder = services.AddIdentityServer(options =>
{
options.Events.RaiseErrorEvents = true;
options.Events.RaiseInformationEvents = true;
options.Events.RaiseFailureEvents = true;
options.Events.RaiseSuccessEvents = true;
})
.AddInMemoryIdentityResources(Config.GetIdentityResources())
.AddInMemoryApiResources(Config.GetApis())
.AddInMemoryClients(Config.GetClients());
services.AddAuthentication()
.AddOpenIdConnect("aad", "Azure AD", options =>
{
options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
options.SignOutScheme = IdentityServerConstants.SignoutScheme;
options.Authority = "https://login.windows.net/...";
options.ClientId = "client_id";
options.ResponseType = "id_token";
options.CallbackPath = new PathString("/signin-aad");
options.SignedOutCallbackPath = new PathString("/signout-callback-aad");
options.RemoteSignOutPath = new PathString("/signout-aad");
options.TokenValidationParameters = new TokenValidationParameters
{
NameClaimType = "name",
RoleClaimType = "role"
};
});
}