asp.net-mvc – Identity Server 3 – 客户端应用程序未知或未经
发布时间:2020-12-16 04:12:37 所属栏目:asp.Net 来源:网络整理
导读:我收到错误’客户端应用程序未知或未经授权.访问我的网站的受保护区域时. 这是我的客户: public static class Clients{ public static IEnumerableClient Get() { return new[] { new Client { Enabled = true,ClientName = "Web Application",ClientId = "
我收到错误’客户端应用程序未知或未经授权.访问我的网站的受保护区域时.
这是我的客户: public static class Clients { public static IEnumerable<Client> Get() { return new[] { new Client { Enabled = true,ClientName = "Web Application",ClientId = "webapplication",Flow = Flows.AuthorizationCode,ClientSecrets = new List<Secret> { new Secret("webappsecret".Sha256()) },RedirectUris = new List<string> { UrlManager.WebApplication },PostLogoutRedirectUris = new List<string> { UrlManager.WebApplication },AllowedScopes = new List<string> { Constants.StandardScopes.OpenId,Constants.StandardScopes.Profile,Constants.StandardScopes.Email,Constants.StandardScopes.Roles,Constants.StandardScopes.OfflineAccess,"read","write" } } }; } } 这是我的Web应用程序启动: public class Startup { public void Configuration(IAppBuilder app) { app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = "Cookies" }); app.USEOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions { Authority = UrlManager.AuthenticationService + "identity",Scope = "openid profile",ResponseType = "code id_token",RedirectUri = UrlManager.WebApplication,SignInAsAuthenticationType = "Cookies" }); } } 这是我的身份验证服务(安装了IDS3)启动: public class Startup { public void Configuration(IAppBuilder app) { app.Map("/identity",idsrvApp => { idsrvApp.UseIdentityServer(new IdentityServerOptions { SiteName = "Authentication Service - Embedded IdentityServer",SigningCertificate = Certificate.LoadCertificate(),Factory = new IdentityServerServiceFactory() .UseInMemoryUsers(Users.Get()) .UseInMemoryClients(Clients.Get()) .UseInMemoryScopes(Scopes.Get()) }); }); } } 这是UrlManager: public static class UrlManager { public static string WebApplication { get { return "https://localhost:44381/"; } } public static string AuthenticationService { get { return "https://localhost:44329/"; } } } 这是我的家庭控制器: public class HomeController : Controller { public ActionResult Index() { return View(); } [Authorize] public ActionResult Private() { return View((User as ClaimsPrincipal).Claims); } } 当我访问Private时,我得到一个Identity Server 3屏幕,它给出了错误消息“客户端应用程序未知或未经授权.”. 我已经读过这可能来自重定向URI中的错误匹配,但据我所知,我的是正确的.我不知道还有什么可以导致它.如果我将流程更改为隐式但我想实现AuthorizationCode流程,则应用程序可以正常运行. 文档似乎也没有说明这一点. 解决方法
客户端已配置为授权代码流
但是启动时的响应类型设置为混合流.
尝试将此更改为
下面是ResponseType和相应的Flow列表 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 如何最好地实现保存|保存并关闭|在ASP.NET
- 是否可以在.NET中将WinForm转换为WebForm?
- 如何最好地生成CSV(逗号分隔的文本文件)以便下载ASP.NET?
- asp.net – 第一次访问网站需要非常长的时间(总共最多68秒)
- asp.net-mvc-4 – 在asp.net mvc 4模型中更改验证触发顺序
- asp.net-ajax – CollapsiblePanelExtender设置已折叠
- asp.net-mvc – 具有不同Http方法的RESTful控制器,但是相同
- asp.net – 有没有一个原因,cshtml不受欢迎
- asp.net-mvc – Html.BeginForm()与GET方法
- asp.net操作xml增删改示例分享
推荐文章
站长推荐
- asp.net – 在资源文件中使用HTML
- asp.net-mvc-3 – 如何让User.Identity在控制器外
- asp.net-mvc – 为什么class属性在WebAPI中不起作
- asp.net – 基于用户更改主题/ CSS
- DxPackNet 3.音频捕捉(录音)
- .NET中的FileUpload控件的使用-Jquery(一)
- 如何在asp.net中使用facebook api创建一个facebo
- asp.net – MVC4项目 – 参数值中不能有点?
- asp.net – 为什么IIS 7.5在重启后重新编译整个网
- asp.net-mvc – Visual studio 2015 CE intellis
热点阅读