将 LDAP 与 hyperledger composer 结合使用
Using LDAP with hyperledger composer
我正在使用以下 LDAP 配置来使用 hyperledger composer 的 ldap 通行证策略:
export COMPOSER_PROVIDERS='{
"ldap": {
"provider": "ldap",
"authScheme": "ldap",
"module": "passport-ldapauth",
"authPath": "/auth/ldap",
"callbackURL": "/auth/ldap/callback",
"successRedirect": "/",
"failureRedirect": "/",
"server": {
"url": "ldap://localhost:389",
"bindDn": "cn=admin,dc=example, dc=com",
"bindCredentials": "*****",
"searchBase": "ou=admin,dc=example,dc=com",
"searchFilter": "(uid={{username}})"
}
}
}'
在github认证我们一般都去http://localhost:3000/auth/github/callback and login to github. Now here in this case what shall I give in web url so that I will get the authentication token. http://localhost:3000/auth/ldap/callback不会有什么结果。那么我是否需要在 ldap 和 web url 中传递现有用户名?如果是,那么 URL 应该是什么?
我认为你没有为 passport-ldapauth
使用回调
所以
export COMPOSER_PROVIDERS='{
"provider": "ldap",
"authScheme":"ldap",
"module": "passport-ldapauth",
"authPath": "/auth/ldap",
"successRedirect": "/auth/account",
"failureRedirect": "/ldap",
"session": false,
"json": true,
"profileAttributesFromLDAP": {
"login": "uid",
"username": "uid",
"displayName": "displayName",
"email": "mail",
"externalId": "uid"
},
"ldap_attribute_for_login": "uid",
"ldap_attribute_for_username": "uid",
"ldap_attribute_for_mail": "mail",
"server":{
"url": "ldap://localhost:389",
"bindDn": "cn=admin,dc=example, dc=com",
"bindCredentials": "*****",
"searchBase": "ou=admin,dc=example,dc=com",
"searchAttributes": ["cn", "mail", "uid", "givenname"],
"searchFilter": "(uid={{username}})"
"url": "ldap://ldap.example.org:389/dc=example,dc=org",
"searchBase": "ou=people,dc=example,dc=org",
"searchFilter": "(uid={{username}})"
}
}'
哪里
- authScheme 应设置为 ldap 模块应设置为
passport-ldapauth
- authPath 为认证路径。 IE。
front-end 将向 /auth/ldap 发送 POST 请求
由用户名和密码组成
- successRedirect 为认证成功重定向的路径。但是,这会被“json”覆盖:true。
- “json”:true 将意味着 Loopback 将 return 一个包含令牌和用户 ID 的 JSON 响应,而不是重定向。暗示这是由 'something else' 完成的,例如 front-end
- failureRedirect 是身份验证失败时重定向到的路径
- session 设置为 false - 不会使用 session
profileAttributesFromLDAP - 在 profileAttributesFromLDAP 部分,如果需要,我们已将映射配置为获取:
- 来自 LDAP uid 的登录名、用户名和 externalId,
- 来自 LDAP 的显示名称的显示名称
来自 LDAP 邮件的电子邮件
如果需要,请在此处添加
ldap_attribute_for_login/username/mail 将需要与
LDAP 服务器等效项
服务器由具有 LDAP 服务器属性的对象组成
另请参阅下面的资源和评论 https://github.com/vesse/passport-ldapauth and https://github.com/strongloop/loopback-component-passport/pull/44#issue-31347869
我正在使用以下 LDAP 配置来使用 hyperledger composer 的 ldap 通行证策略:
export COMPOSER_PROVIDERS='{
"ldap": {
"provider": "ldap",
"authScheme": "ldap",
"module": "passport-ldapauth",
"authPath": "/auth/ldap",
"callbackURL": "/auth/ldap/callback",
"successRedirect": "/",
"failureRedirect": "/",
"server": {
"url": "ldap://localhost:389",
"bindDn": "cn=admin,dc=example, dc=com",
"bindCredentials": "*****",
"searchBase": "ou=admin,dc=example,dc=com",
"searchFilter": "(uid={{username}})"
}
}
}'
在github认证我们一般都去http://localhost:3000/auth/github/callback and login to github. Now here in this case what shall I give in web url so that I will get the authentication token. http://localhost:3000/auth/ldap/callback不会有什么结果。那么我是否需要在 ldap 和 web url 中传递现有用户名?如果是,那么 URL 应该是什么?
我认为你没有为 passport-ldapauth
使用回调所以
export COMPOSER_PROVIDERS='{
"provider": "ldap",
"authScheme":"ldap",
"module": "passport-ldapauth",
"authPath": "/auth/ldap",
"successRedirect": "/auth/account",
"failureRedirect": "/ldap",
"session": false,
"json": true,
"profileAttributesFromLDAP": {
"login": "uid",
"username": "uid",
"displayName": "displayName",
"email": "mail",
"externalId": "uid"
},
"ldap_attribute_for_login": "uid",
"ldap_attribute_for_username": "uid",
"ldap_attribute_for_mail": "mail",
"server":{
"url": "ldap://localhost:389",
"bindDn": "cn=admin,dc=example, dc=com",
"bindCredentials": "*****",
"searchBase": "ou=admin,dc=example,dc=com",
"searchAttributes": ["cn", "mail", "uid", "givenname"],
"searchFilter": "(uid={{username}})"
"url": "ldap://ldap.example.org:389/dc=example,dc=org",
"searchBase": "ou=people,dc=example,dc=org",
"searchFilter": "(uid={{username}})"
}
}'
哪里
- authScheme 应设置为 ldap 模块应设置为 passport-ldapauth
- authPath 为认证路径。 IE。 front-end 将向 /auth/ldap 发送 POST 请求 由用户名和密码组成
- successRedirect 为认证成功重定向的路径。但是,这会被“json”覆盖:true。
- “json”:true 将意味着 Loopback 将 return 一个包含令牌和用户 ID 的 JSON 响应,而不是重定向。暗示这是由 'something else' 完成的,例如 front-end
- failureRedirect 是身份验证失败时重定向到的路径
- session 设置为 false - 不会使用 session
profileAttributesFromLDAP - 在 profileAttributesFromLDAP 部分,如果需要,我们已将映射配置为获取:
- 来自 LDAP uid 的登录名、用户名和 externalId,
- 来自 LDAP 的显示名称的显示名称
来自 LDAP 邮件的电子邮件
如果需要,请在此处添加
ldap_attribute_for_login/username/mail 将需要与 LDAP 服务器等效项
服务器由具有 LDAP 服务器属性的对象组成
另请参阅下面的资源和评论 https://github.com/vesse/passport-ldapauth and https://github.com/strongloop/loopback-component-passport/pull/44#issue-31347869