实现自定义OpenID ASP.Net MVC 5

时间:2017-10-03 16:53:12

标签: asp.net-mvc asp.net-mvc-5 jwt openid

我正在使用ASP.Net MVC 5来实现OpenID身份验证。 在我的App_Start / Startup.Auth.cs文件中,我添加了以下代码块

using Microsoft.Owin.Security.Cookies;
using Owin;
using Microsoft.Owin.Security.OpenIdConnect;
using System.IdentityModel.Tokens;

  public partial class Startup
  {
    public void ConfigureAuth(IAppBuilder app)
    {
    app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions()
        {
            Authority = "https://somecustomurl.com/sso/oauth2",
            ResponseType = "code id_token",
            ClientId = "myclientid",
            ClientSecret = "myclientsecret",
            SignInAsAuthenticationType = CookieAuthenticationDefaults.AuthenticationType,
            Scope = "openid email",
            AuthenticationMode = Microsoft.Owin.Security.AuthenticationMode.Active
        }); 
  } }

我可以在外部网站上使用我的OpenID凭据登录,但是当它将我发回我的域名时,我收到此错误

 IDX10501: Signature validation failed. Key tried: 'System.IdentityModel.Tokens.RsaSecurityKey'.
    token: '{"typ":"JWT","kid":"jdhfgjkfdhgkjgkd","alg":"RS256"}

我尝试了谷歌的一些指导,但未能找到具体的东西。 解决此问题的任何指导都会有所帮助

0 个答案:

没有答案