ภาพรวม
ในส่วนนี้ เราจะแสดงวิธีการเชื่อมต่อแอปพลิเคชันของคุณกับ 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.
- มีระดับความสุกและการสนับสนุนจากชุมชนอย่างกว้างขวาง
ดังนั้น แอปพลิเคชันของคุณจะสื่อสารกับ Casdoor ผ่าน OAuth 2.0 (OIDC) มีสามวิธีในการเชื่อมต่อกับ Casdoor:
ไคลเอนต์ 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 เต็มรูปแบบ หากแอปพลิเคชันของคุณกำลังใช้ผู้ให้บริการตัวตน OAuth 2.0 (OIDC) อื่นๆ ผ่าน ไลบรารีไคลเอนต์ OIDC มาตรฐาน และคุณต้องการย้ายไปใช้ Casdoor การใช้ OIDC discovery จะทำให้การเปลี่ยนไปใช้ Casdoor เป็นเรื่องที่ ง่าย
SDK ของ Casdoor
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 คืออะไร?
Security Assertion Markup Language (SAML) เป็นมาตรฐานเปิดที่ช่วยให้ผู้ให้บริการตัวตน (IdP) สามารถส่งข้อมูลรับรองการอนุญาตไปยังผู้ให้บริการบริการ (SP) 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 ใช้ Extensible Markup Language (XML) สำหรับการสื่อสารที่มีมาตรฐานระหว่างผู้ให้บริการตัวตนและผู้ให้บริการบริการ SAML เป็นส่วนเชื่อมโยงระหว่างการตรวจสอบสิทธิ์ของผู้ใช้งานกับการอนุญาตให้ใช้บริการ
Casdoor สามารถใช้เป็น SAML IdP ได้ ปัจจุบัน Casdoor รองรับคุณสมบัติหลักของ SAML 2.0 สำหรับรายละเอียดเพิ่มเติม ดูที่ SAML
ตัวอย่าง:
Casdoor เป็น SAML IdP ใน Keycloak
ข้อเสนอแนะ:
- โปรโตคอลนี้ ทรงพลัง และครอบคลุมหลายสถานการณ์ ทำให้เป็นหนึ่งในโปรโตคอล SSO ที่ครอบคลุมที่สุด
- โปรโตคอลนี้ ใหญ่ มีพารามิเตอร์ที่เลือกใช้ได้มากมาย จึงยากที่จะครอบคลุมทุกสถานการณ์การใช้งาน 100% ในการนำไปใช้จริง
- หากแอปพลิเคชันเป็น แอปพลิเคชันใหม่ ไม่แนะนำให้ใช้ SAML เนื่องจากมีความซับซ้อนทางเทคนิคสูง
CAS
CAS คืออะไร?
Central Authentication Service (CAS) เป็นโปรโตคอลการลงชื่อเข้าใช้เดียวสำหรับเว็บ วัตถุประสงค์คือเพื่อให้ผู้ใช้สามารถเข้าถึงแอปพลิเคชันหลายๆ แอปพลิเคชันได้ โดยให้ข้อมูลรับรอง (เช่น รหัสผู้ใช้และรหัสผ่าน) เพียงครั้งเดียว มันยังช่วยให้แอปพลิเคชันเว็บสามารถตรวจสอบผู้ใช้โดยไม่ต้องเข้าถึงข้อมูลรักษาความปลอดภัยของผู้ใช้ เช่น รหัสผ่าน
Casdoor ได้นำไปใช้คุณสมบัติของ CAS 1.0, 2.0 และ 3.0 สำหรับรายละเอียดเพิ่มเติม ดูที่ CAS
ข้อเสนอแนะ:
- โปรโตคอลเองมีน้ำหนักเบาและง่ายต่อการนำไปใช้ แต่สามารถแก้ไขได้เพียงสถานการณ์เดียว
- ความไว้วางใจร่วมกันระหว่าง CAS Client และ CAS Server ถูกสร้างขึ้นผ่านการเรียกใช้งานอินเตอร์เฟสโดยไม่มีกลไกการเข้ารหัสหรือลายเซ็นเพื่อให้มั่นใจในความปลอดภัยเพิ่มเติม
- โปรโตคอล CAS ไม่มีข้อได้เปรียบเหนือโปรโตคอลอื่นๆ
ตารางการรวม
บางแอปพลิเคชันมีตัวอย่างที่เชื่อมต่อกับ Casdoor แล้ว คุณสามารถทำตามเอกสารเพื่อเชื่อมต่อกับ Casdoor ได้อย่างรวดเร็ว คุณสามารถดูแอปพลิเคชันทั้งหมดใน ตารางการรวม