You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@submarine.apache.org by GitBox <gi...@apache.org> on 2020/08/09 21:45:08 UTC

[GitHub] [submarine] pingsutw commented on a change in pull request #372: SUBMARINE-580. Add an api for user login

pingsutw commented on a change in pull request #372:
URL: https://github.com/apache/submarine/pull/372#discussion_r467632083



##########
File path: submarine-sdk/pysubmarine/submarine/experiment/api/experiment_client.py
##########
@@ -141,3 +142,17 @@ def list_log(self, status):
         """
         response = self.experiment_api.list_log(status=status)
         return response.result
+
+    def login_ad(self, ldap_url, user_dn, password):
+        ld = ldap.initialize(ldap_url)
+        ld.protocol_version = 3
+        ld.set_option(ldap.OPT_REFERRALS, 0)
+        ld.simple_bind_s(user_dn, password)
+        cn = user_dn.split(',')[0].split('=')
+        base_dn = 'dc=testad,dc=com'
+        domain = 'testad.com'
+        username = '%s@%s' % (cn[1], domain)
+        ret = ld.search_s(base_dn, ldap.SCOPE_SUBTREE, "(userPrincipalName=%s" % username, ["userPrincipalName"])

Review comment:
       ```suggestion
           ret = ld.search_s(base_dn, ldap.SCOPE_SUBTREE,
                             "(userPrincipalName=%s" % username, ["userPrincipalName"])
   ```

##########
File path: submarine-sdk/pysubmarine/github-actions/test-requirements.txt
##########
@@ -31,3 +31,4 @@ six >= 1.10
 python_dateutil >= 2.5.3
 setuptools >= 21.0.0
 urllib3 >= 1.15.1
+pyldap == 2.4.37

Review comment:
       Remove it

##########
File path: submarine-sdk/pysubmarine/setup.py
##########
@@ -40,6 +40,7 @@
         'python-dateutil >= 2.5.3',
         'pyarrow==0.17.0',
         'torch>=1.4.0',
+        'pyldap==2.4.37'

Review comment:
       ```suggestion
          'python-ldap==3.3.1'
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org