概览
在本节中,我们将向您展示如何将您的应用程序连接到Casdoor。
作为服务提供商(SP),Casdoor 支持两项认证协议:
OAuth 2.0 (OIDC)SAML
作为身份提供商 (Idp),Casdoor 支持四项认证协议:
OAuth 2.0OIDCSAMLCAS 1.0, 2.0, 3.0
OAuth 2.0 (OIDC)
什么是 OAuth 2.0?
OAuth 2是一个授权框架,它使得应用程序——如Facebook,GitHub和Casdoor——能够在HTTP服务上获得对用户账户的有限访问权限。 It works by delegating user authentication to the service that hosts the user account and authorizing third-party applications to access that account. OAuth 2 provides authorization flows for web applications, desktop applications, and mobile devices.
Casdoor的授权程序基于OAuth 2.0协议 。 We recommend using OAuth 2.0 for the following reasons:
- The protocol is simple, easy to implement, and can address many authentication scenarios.
- 该协议成熟度高且社区支持广泛.
如此,您的应用程序将通过 OAuth 2.0 (OIDC) 与 Casdoor 通讯。 这里有三种方式连接到 Cassdoor:
标准 OIDC 客户端
Standard OIDC client: Use a standard OIDC client implementation, which is widely available in any programming language or framework.
什么是OIDC?
OpenID Connect (OIDC) 是一个在OAuth 2.0 框架顶端运行的开放身份验证协议。 Targeted toward consumers, OIDC allows individuals to use single sign-on (SSO) to access relying party sites using OpenID Providers (OPs), such as email providers or social networks, to authenticate their identities. It provides applications or services with information about the user, the context of their authentication, and access to their profile information.
Casdoor 完全支持 OIDC 协议。 如果您的应用程序已经通过标准的OIDC客户端库使用了另一个OAuth 2.0(OIDC)身份提供商,并且您想迁移到Casdoor,使用OIDC发现将使切换到Casdoor变得非常简单。
Casdoor SDKs
Casdoor SDKs: For most programming languages, Casdoor provides easy-to-use SDK libraries built on top of OIDC, with extended functionality that is only available in Casdoor.
Compared to the standard OIDC protocol, Casdoor's SDK provides additional functionality, such as user management and resource uploading. 通过Casdoor SDK连接到Casdoor需要的时间比使用标准的OIDC客户端库要多,但它提供了最佳的灵活性和最强大的API。
Casdoor插件
Casdoor plugin: If your application is built on top of a popular platform (such as Spring Boot, WordPress, etc.) and Casdoor (or a third party) has already provided a plugin or middleware for it, you should use it. Using a plugin is much easier than manually invoking the Casdoor SDK because plugins are specifically designed for their target platform.
插件:
中间件:
SAML
什么是SAML?
安全鉴别标记语言(SAML)是一种开放标准,允许身份提供者(IDP)将授权证书传给服务提供者。 This means you can use one set of credentials to log into many different websites. It's much simpler to manage one login per user than to manage separate logins for email, customer relationship management (CRM) software, Active Directory, etc.
SAML交易使用可扩展标记语言(XML) 在标识提供者和服务提供者之间进行标准化通信。 SAML是用户身份认证和使用服务授权之间的链接。
Casdoor可以用作SAML IdP。 目前,Casdoor支持SAML 2.0的主要功能。 有关更多详细信息,请参见SAML。
示例:
建议:
- 该协议是强大的,覆盖了许多场景,使其成为最全面的SSO协议之一。
- 该协议是大型的,带有许多可选参数,因此在实际实施中很难100%覆盖所有应用场景。
- 如果应用程序是新开发的,由于其高度的技术复杂性,不建议使用SAML。
CAS
什么是CAS?
中央认证服务(CAS)是网络的单点登录协议。 它的目的是允许用户在只提供一次凭证(如用户ID和密码)的情况下访问多个应用程序。 它还允许网络应用程序在不获取用户的安全凭证(如密码)的情况下对用户进行身份验证。
Casdoor已实现了CAS 1.0、2.0和3.0的功能。 有关更多详细信息,请参见CAS。
建议:
- 该协议本身相对轻量级且易于实现,但它只能解决单一场景。
- CAS 客户端和CAS服务器之间的相互信任是通过在没有任何加密或签名机制的情况下使用接口建立的,目的是确保进一步的安全。
- CAS协议并无优于其他协议的优点。
集成表
一些应用程序已有连接到Casdoor的示例。 您可以按照文档指示操作,快速连接到Casdoor。 您可以在集成表中查看所有应用程序。