Overview
In this section, we will show you how to connect your application to Casdoor.
As a Service Provider (SP), Casdoor supports two authentication protocols:
OAuth 2.0 (OIDC)
SAML
As an Identity Provider (IdP), Casdoor supports four authentication protocols:
OAuth 2.0
OIDC
SAML
CAS 1.0, 2.0, 3.0
OAuth 2.0 (OIDC)
What is OAuth 2.0?
Casdoor's authorization process is built upon the OAuth 2.0 protocol. We recommend using the OAuth 2.0 protocol for the following reasons:
- The protocol is simple and easy to implement, and can solve many scenarios.
- It has a high maturity level and extensive community support.
Therefore, your application will communicate with Casdoor via OAuth 2.0 (OIDC). There are three ways to connect to Casdoor:
Standard OIDC client
Standard OIDC client: Use a standard OIDC client implementation, which is widely provided in any programming language or framework.
What is OIDC?
Casdoor fully supports the OIDC protocol. If your application is already using another OAuth 2.0 (OIDC) identity provider via a standard OIDC client library, and you want to migrate to Casdoor, using OIDC discovery will make it very easy to switch to Casdoor.
Casdoor SDKs
Casdoor SDKs: For most programming languages, Casdoor provides easy-to-use SDK libraries on top of OIDC, with extended functionality that is only available in Casdoor.
Compared to the standard OIDC protocol, Casdoor's SDK provides more functionalities, like user management and resource uploading, among others. Connecting to Casdoor via the Casdoor SDK requires more time than using a standard OIDC client library, but it offers the best flexibility and the most powerful API.
Casdoor plugin
Casdoor plugin: If your application is built on top of a popular platform (like 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 the former is specially made for the platform.
Plugins:
Middleware:
SAML
What is SAML?
Casdoor can be used as an SAML IdP. Currently, Casdoor supports the main features of SAML 2.0. For more details, see SAML.
Example:
Casdoor as a SAML IdP in Keycloak
Suggestions:
- The protocol is powerful and covers many scenarios, making it one of the most comprehensive SSO protocols.
- The protocol is large, with many optional parameters, so it is difficult to cover all application scenarios 100% in the actual implementation.
- If the application is newly developed, SAML is not recommended due to its high technical complexity.
CAS
What is CAS?
Casdoor has implemented CAS 1.0, 2.0, and 3.0 features. For more details, see CAS.
Suggestions:
- The protocol itself is relatively lightweight and easy to implement, but it can only solve a single scenario.
- The mutual trust between the CAS Client and the CAS Server is established through interface invocation without any encryption or signature mechanism to ensure further security.
- The CAS protocol has no advantage over other protocols.
Integrations table
Some applications already have examples that connect to Casdoor. You can follow the documentation to quickly connect to Casdoor. You can see all applications in the Integrations table.