getChecker() public static method

Get the checker.
public static getChecker ( ) : League\OAuth2\Server\ResourceServer
return League\OAuth2\Server\ResourceServer
Esempio n. 1
0
 /**
  * @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);
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 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);
             }
         });
     }
 }