【发布时间】:2019-11-20 17:11:32
【问题描述】:
在我的天蓝色活动目录中注册应用程序后,我可以在回调中获取用户:
object(Magium\ActiveDirectory\Entity)#262 (1) {
["data":protected]=>
array(16) {
["aud"]=> string(36) "xxxxxxxxxxxxxxxxxxxx"
["iss"]=> string(75) "https://login.microsoftonline.com/xxxxxxxxxxxxxxxxxxxx/v2.0"
["iat"]=> int(xxxxxxxxxxxxxxxxxxxx)
["nbf"]=> int(xxxxxxxxxxxxxxxxxxxx)
["exp"]=> int(xxxxxxxxxxxxxxxxxxxx)
["aio"]=> string(140) "xxxxxxxxxxxxxxxxxxxx"
["email"]=> string(20) "xxxxxxxxxxxxxxxxxxxx@xxxxxxxxxxxxxxxxxxxx.com"
["idp"]=> string(61) "https://sts.windows.net/xxxxxxxxxxxxxxxxxxxx/"
["name"]=> string(13) "xxxxxxxxxxxxxxxxxxxx"
["oid"]=> string(36) "xxxxxxxxxxxxxxxxxxxx"
["preferred_username"]=> string(20) "xxxxxxxxxxxxxxxxxxxx@xxxxxxxxxxxxxxxxxxxx.com"
["sub"]=> string(43) "xxxxxxxxxxxxxxxxxxxx"
["tid"]=> string(36) "xxxxxxxxxxxxxxxxxxxx"
["uti"]=> string(22) "xxxxxxxxxxxxxxxxxxxx"
["ver"]=> string(3) "2.0"
["access_token"]=> string(1910) "xxxxxxxxxxxxxxxxxxxx"
}
}
但是我如何访问我在我的天蓝色活动目录中声明的他所属的组? ps:获取用户的代码是这样的:
@php
session_start();
$config = [
'authentication' => [
'ad' => [
'client_id' => 'xxxxxxx',
'client_secret' => 'xxxxxxx',
'enabled' => 'yes',
'directory' => "xxxxxxx",
'return_url' => 'xxxxxxx'
]
]
];
$request = new \Zend\Http\PhpEnvironment\Request();
$ad = new \Magium\ActiveDirectory\ActiveDirectory(
new \Magium\Configuration\Config\Repository\ArrayConfigurationRepository($config),
Zend\Psr7Bridge\Psr7ServerRequest::fromZend(new \Zend\Http\PhpEnvironment\Request())
);
$entity = $ad->authenticate();
echo $entity->getName() . '<Br />';
echo $entity->getPreferredUsername() . '<Br />';
@endphp
我点击了 Azure Active Directory-> 组 -> 创建组 -> 添加用户 -> 完成。 这就是我创建组的方式。 但是在我对用户的回调中,我无法让它工作。 我完全无能为力,请帮忙。 非常感谢你们!
【问题讨论】:
标签: php laravel azure-active-directory