Создание клиента ASP. NET MVC 5 для IdentityServer4.
Проблема в обратном URL. при попадании на страницу клиентского приложения запрос переходит на страницу входа IdentityServer4 и перенаправляется обратно на MVC запрашиваемую клиентом страницу. Проблема здесь, вернитесь к пустой белой странице и перехватите ошибку как IDX10609: Decryption failed. No Keys tried: token: '[PII is hidden]'.
Не могли бы вы помочь здесь, чего не хватает ниже для простоты и потока токенов. И это приводит к вышеуказанной ошибке и белой странице.
Ниже приведена конфигурация аутентификации.
public void ConfigureAuth(IAppBuilder app)
{
AntiForgeryConfig.UniqueClaimTypeIdentifier = "sub";
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies",
CookieHttpOnly = true
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
Authority = ConfigurationManager.AppSettings["Authority"],
ClientId = ConfigurationManager.AppSettings["ClientId"],
ClientSecret = ConfigurationManager.AppSettings["ClientSecret"],
RedirectUri = ConfigurationManager.AppSettings["RedirectUri"],
ResponseType = OpenIdConnectResponseType.IdTokenToken,
Scope = "offline_access openid profile",
RequireHttpsMetadata = bool.Parse(ConfigurationManager.AppSettings["IsProduction"]),
SignInAsAuthenticationType = "Cookies",
Notifications = new OpenIdConnectAuthenticationNotifications
{
SecurityTokenValidated = n =>
{
var id = n.AuthenticationTicket.Identity;
id.AddClaim(new System.Security.Claims.Claim("access_token", n.ProtocolMessage.AccessToken));
n.AuthenticationTicket = new Microsoft.Owin.Security.AuthenticationTicket(id, n.AuthenticationTicket.Properties);
return Task.FromResult(0);
}
});
}