无论我是否明确指定,我都没有获得mobile和TelephoneNumber属性。有点奇怪。
var attributes : {
user : ["displayName", "givenName", "mail", "userPrincipalName", "sAMAccountName", "mobile", "homePhone", "middleName", "telephoneNumber"],
};
//existing AD strategy initialization as per the documentation
const adConfig = {
url: Config.activeDirectory.url,
baseDN: Config.activeDirectory.baseDN,
username: Config.activeDirectory.username,
password: Config.activeDirectory.password,
//attributes: attributes
};
const AD = new ActiveDirectory(adConfig);
passport.use(new ActiveDirectoryStrategy({
integrated: false,
ldap: AD,
passReqToCallback: true
}, function (req, profile, ad, done) {
let data = {
displayName: profile._json.displayName,
userName: profile._json.sAMAccountName,
email: profile._json.userPrincipalName,
mobile: profile._json.mobile || "",
mfa: false
}
下面的是从profile._json对象返回的响应。我找不到mobile和telephpneNumber字段
{
displayName: "Tarakesh Pulikonda"
dn: "CN=Tarakesh Pulikonda,CN=Users,DC=...."
givenName: "Tarakesh"
mail: "tarakesh.pulikonda@...."
sAMAccountName: "tarakesh.pulikonda"
sn: "Pulikonda"
userPrincipalName: "tarakesh.pulikonda...."
}