Implement OpenID connect Authetication en asp.net WEB API
Esta es la estructura del proyecto
Este es el access_token Me estoy poniendo en la aplicación Mi cliente angular.
{
"nbf": 1529181048,
"exp": 1529184648,
"iss": "https://localhost:44381",
"aud": [
"https://localhost:44381/resources",
"myaspnetwebapi"
],
"client_id": "AngularCore",
"sub": "1",
"auth_time": 1529181045,
"idp": "local",
"scope": [
"openid",
"profile",
"myaspnetwebapi"
],
"amr": [
"pwd"
]
}
En mi proyecto de API WEB ASP.NET, estoy usando este paquete Nuget de CONEXIÓN ABIERTA ID -https: //www.nuget.org/packages/Microsoft.Owin.Security.OpenIdConnect
He escrito el siguiente código para validar el token Pero estoy obteniendo 401. Por favor, ayúdame. Estoy atrapado como cualquier cosa. :( Gracias por adelantado
public partial class Startup
{
public void ConfigureAuth(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
ClientId = "AngularCore",
Authority = "https://localhost:44381",
TokenValidationParameters = new TokenValidationParameters()
{
ValidAudience = "myaspnetwebapi"
}
});
}
}