簡體   English   中英

如何為 Mantis - LDAP 和數據庫用戶設置雙重身份驗證?

[英]How to set up dual authentication for Mantis - LDAP and database users?

我們有一個 MantisBT 實例,我們設法設置了 LDAP 身份驗證,但我們還需要啟用基於 Mantis 用戶的身份驗證(對於某些用戶,與 LDAP 分開)與此問題中的 Ruby 非常相似。

不幸的是,您似乎可以輕松地將 Mantis 設置為通過 LDAP 或通過其用戶進行身份驗證,但同時啟用這兩種身份驗證協議是有問題的。 你有什么建議嗎?

查看源代碼,在實際執行身份驗證的函數auth_does_password_match()中:

function auth_does_password_match( $p_user_id, $p_test_password ) {
    $t_configured_login_method = config_get_global( 'login_method' );

    if ( LDAP == $t_configured_login_method ) {
        return ldap_authenticate( $p_user_id, $p_test_password );
    }

    # code continues with a try for each of the other authentication methods
    # ...
}

第一個條件測試登錄方法$t_configured_login_method ,如果它是“LDAP”,則嘗試相應地進行身份驗證。 好的,這里沒什么瘋狂的,但是語句return ldap_authenticate(...); 不允許使用其他身份驗證方法。

希望補丁不是什么大問題,這樣如果 LDAP 身份驗證失敗,它可以回退到其他身份驗證方法。

基本上,它要求在 LDAP 身份驗證成功時才返回ldap_authenticate()的返回值,否則不需要,以便代碼可以繼續嘗試使用其他身份驗證方法。 第一個條件如下所示:

    if (LDAP == $t_configured_login_method && ldap_authenticate($p_user_id, $p_test_password)) {
        return TRUE;
    }

為了使事情正確,您可以為t_configured_login_method創建自己的常量,以便您可以添加自己的邏輯並且不干擾其他身份驗證方法。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM