我是 IdentityServer3 的新手,刚刚开始设置它。似乎进展顺利,我一直在为 MVC 应用程序开发混合流程,类似于 Kevin Dockx 的 Pluralsight 课程中所示的内容(http://www.pluralsight.com/courses/building-secure-restful-api-aspdotnet http://www.pluralsight.com/courses/building-securing-restful-api-aspdotnet)
当我尝试使用 MVC 配置 IdentityServer 时,会弹出错误 -Microsoft.IdentityModel.Protocols.OpenIdConnectProtocolException: invalid_request
身份服务器:
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
with ServiceStack' for this I used link
https://github.com/MacLeanElectrical/servicestack-authentication-identityserver https://github.com/MacLeanElectrical/servicestack-authentication-identityserver` 对服务进行身份验证,但在 Global.aspx 中用于 new AppHost().Init();它显示错误-
'System.NullReferenceException' occurred in ServiceStack.dll but was not handled in user code