我们想使用该库来简化sso。目前,我们已经登录了希望对外部资源进行身份验证/授权的用户。
问题在于使用户ID进入进程。在测试中,仅将userid硬编码到authorize.php脚本中。如下所示:
$user_id = $this->somehowDetermineUserId();
/**
This controller is called when a user should be authorized
by an authorization server. As OAuth2 does not handle
authorization directly, this controller ensures the request is valid, but
requires the application to determine the value of $is_authorized
@code
$user_id = $this->somehowDetermineUserId();
$is_authorized = $this->somehowDetermineUserAuthorization();
$response = new OAuth2\Response();
$authorizeController->handleAuthorizeRequest(
OAuth2\Request::createFromGlobals(),
$response,
$is_authorized,
$user_id
);
$response->send();
@Endcode
*/
在生产中执行此操作的正确方法是什么?谢谢!
这是我们最感兴趣的AuthorizeControllerInterface.php中的代码,
public class MyObject {
private String ownerName;
private List<Pet> pets;
}
public class Pet {
private String name;
}