コード例 #1
0
 /**
  * Register the bindings for the JWT Manager
  */
 protected function registerJWTManager()
 {
     $this->app['tymon.jwt.manager'] = $this->app->share(function ($app) {
         $instance = new JWTManager($app['tymon.jwt.provider.jwt'], $app['tymon.jwt.blacklist'], $app['tymon.jwt.payload.factory']);
         return $instance->setBlacklistEnabled((bool) $this->config('blacklist_enabled'));
     });
 }
コード例 #2
0
ファイル: UserController.php プロジェクト: TFidryForks/spira
 /**
  * Set permissions to be used in the controller.
  *
  * @param  Request  $request
  * @return void
  */
 public function permissions(Request $request)
 {
     $this->lock->setRole(User::$userTypes);
     $user = $this->jwtAuth->user();
     $owner = [User::class, 'userIsOwner', $user, last($request->segments())];
     $this->lock->role(User::USER_TYPE_ADMIN)->permit(['readAll', 'readOne', 'update', 'delete']);
     $this->lock->role(User::USER_TYPE_GUEST)->permit(['readOne', 'update'], [$owner]);
     $this->middleware('permission:readAll', ['only' => 'getAllPaginated']);
     $this->middleware('permission:readOne', ['only' => 'getOne']);
     $this->middleware('permission:update', ['only' => 'patchOne']);
     $this->middleware('permission:delete', ['only' => 'deleteOne']);
 }
コード例 #3
0
ファイル: AuthController.php プロジェクト: TFidryForks/spira
 /**
  * Provide a requester with user information for single sign on.
  *
  * @param  string  $requester
  * @param  Request $request
  *
  * @return Response
  */
 public function singleSignOn($requester, Request $request)
 {
     // A single sign on request might have different requirements and
     // methods how to deal with a non logged in user. So we get the user
     // if possible, and if not we pass in a null user and let the the
     // requester class deal with it according to the requester's definitions
     if ($token = $request->cookie(self::JWT_AUTH_TOKEN_COOKIE)) {
         $user = $this->jwtAuth->toUser($token);
     } else {
         $user = null;
     }
     $requester = SingleSignOnFactory::create($requester, $request, $user);
     return $requester->getResponse();
 }