由于所有权更改,我的公司最近更改了域名,因此我遇到了在新域名上完成LDAP绑定的问题。
我的connect命令正确创建了资源,但是当我去绑定时,我得到了错误。
“警告:ldap_bind():无法绑定到服务器:需要强(呃)身份验证”
我没有使用ldaps。我已经确认我有正确的LDAP域名。
public class Meaning implements Serializable {
@Id
@Column(name = "id", updatable = false, nullable = false)
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@JsonIgnore
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "vocabulary_words_id", nullable = false, updatable = false)
private VocabularyWord vocWord;
@JsonIgnore
@Column(name = "vocabulary_words_id", updatable = false, insertable = false)
private int vocWordId;
@Column(name = "w_type", nullable = true, unique = false)
private String wType;
@Column(name = "example", nullable = true, unique = false)
private String example;
@Column(name = "definition", nullable = true, unique = false)
private String definition;
@Column(name = "translation", nullable = true, unique = false)
private String translation;
//+ getters and setters
}
是资源,$ad
是添加了域名的用户名,$dmun
是密码。
$pw
这是一个内联网网站。
答案 0 :(得分:0)
尝试此代码。这段代码对我有用
$username = 'username';
$password = 'password';
$ldap_host = "domain.com";
$ldap_port = 389;
$base_dn = "DC=domain,DC=com";
$filter = '(sAMAccountName=' . $username . ')';
$connect = ldap_connect($ldap_host, $ldap_port) or exit("Error : Could not connect to LDAP server.");
if ($connect) {
ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($connect, LDAP_OPT_REFERRALS, 0);
if (@$bind = ldap_bind($connect, "$username@domain.com", $password)) {
echo "Bind Successfull";
} else {
echo "Invalid Username / Password";
}
}