【问题标题】:Using LDAP with hyperledger composer将 LDAP 与超级账本作曲家一起使用
【发布时间】:2018-09-21 02:46:42
【问题描述】:

我正在使用以下 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 并登录到 github。现在,在这种情况下,我应该在 web url 中提供什么,以便获得身份验证令牌。 http://localhost:3000/auth/ldap/callback 不会产生任何结果。那么我需要在 ldap 中的 web url 中传递现有的用户名吗?如果是,那么该 URL 应该是什么?

【问题讨论】:

    标签: ldap passport.js hyperledger-composer


    【解决方案1】:

    我不认为您对 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 模块应设置为 护照-ldapauth
    • authPath 是身份验证的路径。 IE。 前端将发送一个 POST 请求到 /auth/ldap 由用户名和密码组成
    • successRedirect 是身份验证成功时重定向到的路径。但是,这被“json”覆盖:true。
    • “json”:true 表示 Loopback 将返回由令牌和 userId 组成的 JSON 响应,而不是重定向。暗示这是由诸如前端之类的“其他东西”完成的
    • failureRedirect 是认证失败时重定向到的路径
    • 会话设置为 false - 不会使用会话
    • profileAttributesFromLDAP - 在 profileAttributesFromLDAP 部分,如果需要,我们已配置映射以获取:

      • LDAP 的 uid 中的登录名、用户名和 externalId,
      • 来自 LDAP 的 displayName 的 displayName
      • 来自 LDAP 邮件的电子邮件

        如果需要,请在此处添加

    • ldap_attribute_for_login/username/mail 需要与 LDAP 服务器等效项

    • 服务器由具有 LDAP 服务器属性的对象组成

    另见https://github.com/vesse/passport-ldapauthhttps://github.com/strongloop/loopback-component-passport/pull/44#issue-31347869下方的资源和评论

    【讨论】:

      猜你喜欢
      • 2018-12-19
      • 1970-01-01
      • 2022-11-10
      • 2018-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多