本文整理汇总了PHP中Authorizer::getChecker方法的典型用法代码示例。如果您正苦于以下问题:PHP Authorizer::getChecker方法的具体用法?PHP Authorizer::getChecker怎么用?PHP Authorizer::getChecker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Authorizer
的用法示例。
在下文中一共展示了Authorizer::getChecker方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: logout
/**
* @author LAHAXE Arnaud
*
* @apiGroup Auth
* @apiName logout
* @api {post} /oauth/logout Logout
*
* @return \Illuminate\Http\RedirectResponse|\Laravel\Lumen\Http\Redirector
*/
public function logout()
{
/** @var TokenHelper $tokenHelper */
$tokenHelper = \App::make(TokenHelper::class);
$tokenHelper->deleteTokens(\Authorizer::getChecker()->getAccessToken()->getId());
// reset session if some dev use session in a rest api :D
\Session::flush();
return response()->json([], 202);
}
示例2: toArray
public function toArray()
{
$array = parent::toArray();
$access_token = Input::get('access_token');
if ($access_token) {
\Authorizer::getChecker()->isValidRequest(true, $access_token);
}
$user_type = \Authorizer::getChecker()->getAccessToken() ? \Authorizer::getResourceOwnerType() : false;
if ($user_type == 'user') {
$array['logs'] = $this->logs();
}
return $array;
}
示例3: bootLogsActivity
protected static function bootLogsActivity()
{
foreach (static::getRecordActivityEvents() as $eventName) {
static::$eventName(function (LogsActivityInterface $model) use($eventName) {
$activity = $model->getActivityDescriptionForEvent($eventName);
$message = isset($activity['logs']) ? $activity['logs'] : '';
$attributes = isset($activity['attributes']) ? $activity['attributes'] : [];
// Integration with lucadegasperi/oauth2-server-laravel
$user_id = \Authorizer::getChecker()->getAccessToken() ? \Authorizer::getResourceOwnerId() : false;
if ($message != '') {
Activity::log($message, $user_id, $attributes);
}
});
}
}