【发布时间】:2016-07-28 13:47:01
【问题描述】:
我是 IdentityServer3 的新手,刚刚开始设置它。它似乎进展顺利,我一直在为 MVC 应用程序开发混合流程,类似于 Kevin Dockx 的 Pluralsight 课程 (http://www.pluralsight.com/courses/building-securing-restful-api-aspdotnet) 中所示的流程
当我尝试使用 MVC 配置 IdentityServer 时,弹出错误-Microsoft.IdentityModel.Protocols.OpenIdConnectProtocolException: invalid_request
ID 服务器:
new Client
{
Enabled = true,
ClientName = "MVC Client (Hybrid Flow)",
ClientId = "mvc",
Flow = Flows.Hybrid,
RequireConsent = true,
RedirectUris = new List<string>
{"https://localhost:44358/"},
}
var scopes = new List<Scope>{
StandardScopes.OpenId,
StandardScopes.Profile
};
以下是来自 MVC 客户端应用程序的代码
public void Configuration(IAppBuilder app)
{
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies",
//CookieName = "ourcookiename"
});
var options = new OpenIdConnectAuthenticationOptions
{
ClientId = "mvc",
Authority = "https://localhost:44367/identity/",
RedirectUri = "https://localhost:44358/",
// PostLogoutRedirectUri = "https://localhost:44300/",
SignInAsAuthenticationType = "Cookies",
ResponseType = "code id_token token",
Scope = "openId profile"
};
app.UseOpenIdConnectAuthentication(options);
}
并且还必须配置 IdentityServer3 和 ServiceStack' for this I used linkhttps://github.com/MacLeanElectrical/servicestack-authentication-identityserver` 来验证服务,但在 Global.aspx 中为 new AppHost().Init();它显示错误-
'System.NullReferenceException' occurred in ServiceStack.dll but was not handled in user code
【问题讨论】:
-
你需要开启日志记录
标签: asp.net-mvc-4 servicestack identityserver3