简体   繁体   English

我如何获得在Zend Framework 2中针对用户进行身份验证的BaseDn

[英]How do I get the BaseDn the user is authenticated against in Zend Framework 2

I have authenticated the user against one of many LDAP configs and I now want to retrieve what the BaseDn is that they have authenticated against so that I can search and get more information for that user. 我已针对许多LDAP配置之一对用户进行了身份验证,现在我想检索已针对其进行身份验证的BaseDn,以便我可以搜索并获取该用户的更多信息。

Debugging at this line: 在这行调试:

        if ($auth->hasIdentity()) {

            $uid = $auth->getIdentity();

In debug I can see that the $auth object contains an adapter (Zend\\Authentication\\Adapter\\Ldap) -> ldap (Zend\\Ldap\\Ldap) -> options[16] and I want BaseDn. 在调试中,我可以看到$ auth对象包含一个适配器(Zend \\ Authentication \\ Adapter \\ Ldap)-> ldap(Zend \\ Ldap \\ Ldap)-> options [16],我想要BaseDn。

So how/can I get at it from the $auth that's returned? 那么,如何/可以从返回的$ auth中得到它呢?

Apologies if really simple. 道歉,如果真的很简单。

道歉非常简单,万一其他人需要它,可以将其保留在这里:

$baseDn = $auth->getAdapter()->getLdap()->getBaseDn();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM