Пример #1
0
 public function testCallback()
 {
     $user = null;
     $callback = 'categories';
     $request = $this->mockRequest(false, false, false, $callback);
     $requester = SingleSignOnFactory::create('vanilla', $request, $user);
     $response = $requester->getResponse();
     $this->assertStringStartsWith($callback . '(', $response);
     $this->assertStringEndsWith(')', $response);
 }
Пример #2
0
 /**
  * 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();
 }