跳到主内容

将应用连接到 Casdoor

您的应用通过标准协议与 Casdoor 进行用户登录。本页帮助您选择协议和客户端类型,并提供每种选择的指南链接。

选择协议​

Casdoor 是以下协议的身份提供商 (IdP):

ProtocolUse it whenGuide
OAuth 2.0 and OpenID Connect (OIDC)You build a new application, or your application already supports OIDC. This is the recommended protocolOAuth 2.0
SAML 2.0Your application or a product that you bought supports only SAMLSAML
CAS 1.0、2.0 和 3.0You connect an existing application that supports only CASCAS

Casdoor 也是一个服务提供商 (SP):它允许用户通过 OAuth 2.0、OIDC 和 SAML 使用外部身份提供商的账户登录。参见 Providers。

OAuth 2.0 和 OpenID Connect​

OAuth 2.0 是一个授权框架。它允许应用在无需查看用户密码的情况下,获取对用户服务账户的有限访问权限。OpenID Connect 在 OAuth 2.0 之上增加了身份层:这是应用了解用户身份的标准方式,并支持跨应用的单点登录 (SSO)。

Casdoor 的登录流程是 OAuth 2.0 授权码流程,且 Casdoor 是一个完整的 OIDC 提供商。请选择以下三种客户端类型之一:

ClientUse it whenGuide
Standard OIDC client libraryYour language or framework has an OIDC library, or your application already uses another OIDC provider. Switching to Casdoor is then a change of the discovery URL and the credentials标准 OIDC 客户端
Casdoor SDKYou also want to call the Casdoor API from your application, for example to manage users or upload files. The SDKs build on OIDC and add these functionsCasdoor SDKs
Casdoor plugin or middlewareYour application runs on a platform that has one. This is the fastest way to add Casdoor to that platformCasdoor plugins

插件和中间件包括:

SAML​

安全断言标记语言 (SAML) 是一种基于 XML 的标准,身份提供商 (IdP) 通过它将认证和授权信息传递给服务提供商 (SP)。它在企业 SSO 中很常见。

Casdoor 是一个 SAML 2.0 IdP,并支持 SAML 2.0 的主要功能。参见 SAML。有关示例,请参见 在 Keycloak 中添加 Casdoor 作为 SAML IdP。

SAML 是一个包含许多可选部分的大型协议。对于新应用,OAuth 2.0 和 OIDC 更简单。只有当您需要连接仅支持 SAML 的系统时,才选择 SAML。

CAS​

中央认证服务(CAS)是一种 Web 单点登录协议。 Applications authenticate users through the CAS server and never handle passwords.

Casdoor 支持 CAS 1.0、2.0 和 3.0。参见 CAS。

CAS 轻量但功能有限。CAS 客户端和服务器通过后通道调用建立信任,而不是通过加密签名。对于新应用,建议优先使用 OAuth 2.0 和 OIDC。

特定应用的分步指南​

要连接特定产品(如 GitLab、Grafana 或 Jenkins),请参见 Integrations。

另请参阅​