Authing 支持使用 LDAP 协议查看、修改、增加和删除用户信息,本页面包含了一些基础信息和使用教程。
信息 | 值 |
Hostname | ldap://ldap.authing.cn |
Port | 1389 |
LDAP Distinguished Name | cn=AUTHING_USERNAME, ou=users, o=AUTHING_CLINET_ID, dc=authing, dc=cn |
Base DN | ou=users, o=AUTHING_CLINET_ID, dc=authing, dc=cn |
访问 Authing LDAP 服务器需要使用 Authing 的应用密钥 (Secret),认证命令如下所示:
$ ldapsearch -H ldap://ldap.authing.cn:1389 -x -D "ou=users,o=AUTHING_CLIENT_ID,dc=authing,dc=cn" -w "AUTHING_CLIEENT_SECRET" -LLL -b "ou=users,o=AUTHING_CLIENT_ID,dc=authing,dc=cn"
若密钥 (Secret) 不正确会返回如下信息:
ldap_bind: Invalid credentials (49)matched DN: ou=users, o=AUTHING_CLIENT_ID, dc=authing, dc=cnadditional info: InvalidCredentialsError
$ ldapsearch -H ldap://ldap.authing.cn:1389 -x -D "ou=users,o=AUTHING_CLIENT_ID,dc=authing,dc=cn" -w "AUTHING_CLIEENT_SECRET" -LLL -b "ou=users,o=AUTHING_CLIENT_ID,dc=authing,dc=cn"
创建一个名为 user.ldif 的文件然后复制以下内容进去:
dn: cn=authingUserName, ou=users, o=AUTHING_CLIENT_ID, dc=authing, dc=cnobjectClass: userscn: authingUserName
然后执行以下命令:
$ ldapadd -H ldap://ldap.authing.cn:1389 -x -D "ou=users,o=AUTHING_CLIENT_ID,dc=authing,dc=cn" -w "AUTHING_CLIEENT_SECRET" -f ./user.ldif
创建一个名为 modify.ldif 的文件然后复制以下内容进去:
dn: cn=secret, ou=users, o=AUTHING_CLIENT_ID, dc=authing, dc=cnchangetype: modifyreplace: mailmail: test@authing.cn
然后执行以下命令:
$ ldapmodify -H ldap://ldap.authing.cn:1389 -x -D "ou=users,o=AUTHING_CLIENT_ID,dc=authing,dc=cn" -w "AUTHING_CLIEENT_SECRET" -f ./modify.ldif
$ ldapdelete -H ldap://ldap.authing.cn:1389 -x -D "ou=users,o=AUTHING_CLIENT_ID,dc=authing,dc=cn" -w "AUTHING_CLIEENT_SECRET" "cn=authingUserName, ou=users, o=AUTHING_CLIENT_ID, dc=authing,dc=cn"