IdentityServer4 是为ASP.NET Core 2.系列量身打造的一款基于 OpenID Connect 和 OAuth 2.0 认证框架。
将identityserver部署在你的应用中,具备如下的特点
认证服务
可以为你的应用(如网站、本地应用、移动端、服务)做集中式的登录逻辑和工作流控制。IdentityServer是完全实现了OpenID Connect协议标准。
单点登录登出(SSO)
在各种类型的应用上实现单点登录登出。
API访问控制
为各种各样的客户端颁发access token令牌,如服务与服务之间的通讯、网站应用、SPAS和本地应用或者移动应用。
联合网关
支持来自Azure Active Directory, Google, Facebook这些知名应用的身份认证,可以不必关心连接到这些应用的细节就可以保护你的应用。
专注于定制
最重要的是identityserver可以根据需求自行开发来适应应用程序的变化。identityserver不是一个框架、也不是一个盒装产品或一个saas系统,您可以编写代码来适应各种场景。
成熟的开源系统
IdentityServer拥有apache 2 授权许可,允许构建商业化的应用,也是.net基金会组织的成员之一,并未其提供法律支持。
免费和商业支持
如果您在构建和运行你的身份认证平台时需要帮助,我们可以通过几种方法帮助您。
IdentityServer4在.net core 中的简单示例:
1.添加Nuget包:IdentityServer4
2.添加Startup配置。
3.添加Config.cs 配置类。
4.更改IdentityServer4配置。
5.添加客户端配置。
部分代码如下:
IdentityServer4 在这个里面会给出一些基本的配置 https://localhost:44340/.well-known/openid-configuration
格式化以后:
{
"issuer": "https://localhost:44340",
"jwks_uri": "https://localhost:44340/.well-known/openid-configuration/jwks",
"authorization_endpoint": "https://localhost:44340/connect/authorize",
"token_endpoint": "https://localhost:44340/connect/token",
"userinfo_endpoint": "https://localhost:44340/connect/userinfo",
"end_session_endpoint": "https://localhost:44340/connect/endsession",
"check_session_iframe": "https://localhost:44340/connect/checksession",
"revocation_endpoint": "https://localhost:44340/connect/revocation",
"introspection_endpoint": "https://localhost:44340/connect/introspect",
"device_authorization_endpoint": "https://localhost:44340/connect/deviceauthorization",
"frontchannel_logout_supported": true,
"frontchannel_logout_session_supported": true,
"backchannel_logout_supported": true,
"backchannel_logout_session_supported": true,
"scopes_supported": ["offline_access"],
"claims_supported": [],
"grant_types_supported": ["authorization_code", "client_credentials", "refresh_token", "implicit", "urn:ietf:params:oauth:grant-type:device_code"],
"response_types_supported": ["code", "token", "id_token", "id_token token", "code id_token", "code token", "code id_token token"],
"response_modes_supported": ["form_post", "query", "fragment"],
"token_endpoint_auth_methods_supported": ["client_secret_basic", "client_secret_post"],
"id_token_signing_alg_values_supported": ["RS256"],
"subject_types_supported": ["public"],
"code_challenge_methods_supported": ["plain", "S256"],
"request_parameter_supported": true
}