一级域名的网站怎么做,国内老牌的网站制作,成功的品牌推广案例分析,网站添加icp信息以下#xff0c;称这个使用了IdentityServer4的OAuth2.0服务的项目称为Passport项目。
组件说明#xff08;Nuget#xff09; Passport项目所需组件 项目以Asp.net Core Identity项目模板初始化#xff0c;集成IdentityServer4中间件#xff1b;集成IdentityServer4.AspN…以下称这个使用了IdentityServer4的OAuth2.0服务的项目称为Passport项目。
组件说明Nuget Passport项目所需组件 项目以Asp.net Core Identity项目模板初始化集成IdentityServer4中间件集成IdentityServer4.AspNetIdentity用于管理User体系集成IdentityServer4.EntityFramework用于持久化OAuth2.0相关角色数据集成NLog.Web.AspNetCore用于输出日志集成System.Security.Cryptography.Csp使用RSA进行Token签名 ApiResource提供Api服务注册到Passport中所需组件 如果是Asp.Net Core WebApi项目集成IdentityServer4.AccessTokenValidation(使用Authorize Policy机制即可)如果是Asp.Net WebApi项目集成IdentityServer3.AccessTokenValidation中间件Thinktecture.IdentityModel.WebApi.ScopeAuthorization提供ScopeAuthorize Client所需组件 IdentityModel提供TokenClient 注意事项 其一ApiResource 无需配置ApiSecret中间件会请求http://{passport-project-domain}/.well-known/openid-configuration/jwks获取RSA公钥验签;其二Client端调用方必须设置密码clientId,clientSecret,请求所需scopes其三配置RSA的时候千万不能忘记设置KeyId否则IdentityServer3.AccessTokenValidation获取jwks时kid为null将抛异常。建议KeyId和Rsa的Base64字符串一起存配置文件。参考issue 搭建路线
IdentityServer4官方文档:using-asp-net-core-identityIdentityServer4官方文档:using-entityframework-core-for-configuration-data可选UI方面可临时用quickstart-ui可选如果是IdentityServer3还有IdentityServer3.Admin和IdentityServer3.Admin.EntityFrameworkToken签名及验签机制选择:RSA。配置方法参考再强调一遍千万不能忘记设置KeyIdApiResource及Client的配置参考IdentityServer3和4各组件兼容性测试项目Asp.Net WebApi(非.Net Core项目)对Scope进行细粒度验证落实到一个具体Api使用ScopeAuthorize,安装Nuget组件源码参考Install-Package Thinktecture.IdentityModel.WebApi.ScopeAuthorization
Asp.Net Core项目部署笔记
服务器安装DotNetCore.1.0.4_1.1.1-WindowsHosting.exe服务器管理员cmd执行 net stop was /y net start w3svc新建站点站点应用程序池设为无托管代码IIS仅作为反向代理和方便站点发布启用web部署手动vs发布选iiswebdeploy执行连接字符串指定迁移连接字符串如果遇到IIS Aspnet Core Module启动dotnet进程失败web.config启用stdoutLogEnabled并创建logs目录查看错误信息
参考资源
IdentityServer4官方文档IdentityServer3和4各组件兼容性测试项目IdentityServer4.Samplesvalidating-scopes-in-asp-net-4-and-5ASP.NET Core实现OAuth2.0的ResourceOwnerPassword和ClientCredentials模式NLog.Web/wiki/Getting-started-with-ASP.NET-Core-(csproj—vs2017)Host on Windows with IIS
原文地址http://personball.com/oauth2/2017/06/04/tips-of-identity-server-4-application.NET社区新闻深度好文微信中搜索dotNET跨平台或扫描二维码关注