绑定 username/pwd 的变量

Binding with variable for username/pwd

我正在尝试获取登录输入并传递给我们的 AD 服务器以对用户进行身份验证。我不断收到错误消息:invalidCredentials,但我已经多次验证凭据。我是否正确使用变量?任何反馈表示赞赏。我目前有以下代码。

`@app.route('/login', methods=['GET','POST'])
def login():
    username = request.form['username']
    password = request.form['password']
    server = Server('dc.ourcompany.com', use_ssl=True, get_info=ALL)
    conn = Connection(server, user='%s' %username, password='%s' %password, raise_exceptions=False)
    conn.open()
    conn.bind()
    if not conn.bind():
        print('error in bind',  conn.result)`

我收到以下错误:

error in bind {'dn': '', 'message': '80090308: LdapErr: DSID-0C0903A8, comment: AcceptSecurityContext error, data 52e, v1db1\x00', 'result': 49, 'referrals': None, 'saslCreds': None, 'type': 'bindResponse', 'description': 'invalidCredentials'}

我添加了 NTLM 身份验证,这似乎解决了问题。