ข้ามไปยังเนื้อหาหลัก

LDAP Server

ระบบต่างๆ เช่น Nexus รองรับการตรวจสอบสิทธิ์ด้วย LDAP Casdoor ยังได้ทำการพัฒนา LDAP server แบบง่ายๆ ที่รองรับการทำงานของ bind และ search

เอกสารนี้อธิบายวิธีการเชื่อมต่อกับ LDAP server ใน Casdoor และการทำการตรวจสอบสิทธิ์การเข้าสู่ระบบแบบง่ายๆ

LDAP Server Port

LDAP server ฟังที่พอร์ต 389 โดยค่าเริ่มต้น You can change the default port by modifying the ldapServerPort value in conf/app.conf.

วิธีการทำงาน

คล้ายกับ LDAP client ใน Casdoor, ผู้ใช้ใน LDAP server ล้วนเป็น subclasses ของ posixAccount

เมื่อ server ได้รับชุดข้อมูลที่ถูกส่งมาโดย LDAP, มันจะทำการวิเคราะห์ cn และ ou, ที่ cn หมายถึงชื่อผู้ใช้ และ ou หมายถึงชื่อองค์กร dc ไม่สำคัญ

หากเป็นการทำงานของ bind, server จะใช้ Casdoor เพื่อตรวจสอบชื่อผู้ใช้และรหัสผ่าน และให้สิทธิ์ผู้ใช้ใน Casdoor

หากเป็นการทำงานของ search, server จะตรวจสอบว่าการทำงานของ search นั้นถูกต้องตามกฎหมายหรือไม่, ตามสิทธิ์ที่ได้รับจากการทำงานของ bind, และส่งคำตอบกลับ

ข้อมูล

เราเพียงแค่รองรับ Simple Authentication

วิธีการ Bind

ใน Casdoor LDAP server, เราเพียงแค่รู้จัก DN ที่มีรูปแบบคล้ายกับนี้: cn=admin,ou=built-in,dc=example,dc=com

กรุณาตั้งค่า DN ของผู้ดูแลระบบให้มีรูปแบบดังกล่าวข้างต้น จากนั้น, คุณสามารถใช้ DN นี้เพื่อ bind กับ LDAP server ด้วยรหัสผ่านของผู้ใช้เพื่อเข้าสู่ระบบ Casdoor เพื่อการตรวจสอบ หากการตรวจสอบของ server ประสบความสำเร็จ, ผู้ใช้จะได้รับสิทธิ์ใน Casdoor

เมื่อการทำงานของ bind สำเร็จ, คุณสามารถทำการ search มีความแตกต่างบางอย่างระหว่างการทำงานของ search และ bind

  • To search for a certain user, such as Alice under the built-in organization, you should use a DN like this: ou=built-in,dc=example,dc=com, and add cn=Alice in the Filter field.
  • To search for all users under a certain organization, such as all users in built-in, you should use a DN like this: ou=built-in,dc=example,dc=com, and add cn=* in the Filter field.
  • To search for all users in all organizations (assuming the user has sufficient permissions), you should use a DN like this: ou=*,dc=example,dc=com, and add cn=* in the Filter field.
  • To search for all users in a specific group, you should use a filter query like this: (memberOf=organization_name/group_name) in the Filter field.

Supported RFC-Style Features

Partial Root DSE Query Support

The Root DSE (baseDN="") provides directory capabilities.

  • Query namingContexts (organization list): ldapsearch -x -H ldap://<casdoor-host>:389 -D "cn=admin,ou=built-in" -w <passwd> -b "" -s base "(objectClass=*)" namingContexts
    Returns visible organization DNs.

  • Query subschemaSubentry: ldapsearch -x -H ldap://<casdoor-host>:389 -D "cn=admin,ou=built-in" -w <passwd> -b "" -s base "(objectClass=*)" subschemaSubentry
    Returns subschemaSubentry: cn=Subschema.

Schema Query Support

Query objectClasses: ldapsearch -x -H ldap://<casdoor-host>:389 -D "cn=admin,ou=built-in" -w <passwd> -b "cn=Subschema" -s base "(objectClass=*)" objectClasses
Returns definitions for posixAccount and posixGroup.

POSIX Filters

  • (objectClass=posixAccount) returns user list.
  • (objectClass=posixGroup) returns group list under organization (e.g., ldapsearch -x -H ldap://<casdoor-server>:389 -D "cn=admin,ou=built-in" -w <passwd> -b "ou=<org>" "(objectClass=posixGroup)").

Note: (objectClass=posixGroup) Does not support combined searches like (&(objectClass=posixGroup)(cn=<group>)). Please use memberOf for searching members in a group.