Мы хотим использовать библиотеку для облегчения sso. В настоящее время мы вошли в систему пользователей, которые мы хотим аутентифицировать / авторизовать для внешних ресурсов.
Проблема заключается в получении идентификатора пользователя в процессе. В тесте идентификатор пользователя был просто жестко запрограммирован в сценарии authorize.php. Как ниже:
$user_id = '5bd0ad6b-12d0-43c6-ab26-7908a2d14985'; // A value on your server that identifies the user
$server->handleAuthorizeRequest($request, $response, $is_authorized, $user_id);
Как правильно сделать это на производстве? Спасибо!
Вот код в AuthorizeControllerInterface.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
*/