我正在尝试获取Active Directory登录用户的详细信息。现在,通过身份验证的用户需要获取该用户的详细信息。
我尝试使用ldap3中的who_am_i()方法获取用户信息。但是我只得到\
if (username is not None and username != "") and (password is not None and password != ""):
# calling below connect method
conn_obj = self.connect(username, password)
print(conn_obj.extend.standard.who_am_i())
# I need details of logged-in user here
# connect method
def connect(self, username=None, pwd=None):
connection_url = self.ldap_protocol + "://" + self.ldap_host + ":" + self.ldap_port
server = Server(connection_url, get_info=ALL)
if username == None and pwd == None:
conn = Connection(server, self.ldap_username, self.ldap_password, auto_bind=True)
else:
conn = Connection(server, username, pwd, auto_bind=True)
return conn
我无法获得Active Directory登录用户的详细信息。