Esempio n. 1
0
 /**
  * Call this method to redirect user to login page and initiate
  * the Web Server OAuth Authentication Flow.
  *
  * @param null $loginURL
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function authenticate($loginURL = null)
 {
     if (!isset($loginURL)) {
         $loginURL = $this->credentials['loginURL'];
     }
     $loginURL .= '/services/oauth2/authorize';
     $loginURL .= '?response_type=code';
     $loginURL .= '&client_id=' . $this->credentials['consumerKey'];
     $loginURL .= '&redirect_uri=' . urlencode($this->credentials['callbackURI']);
     if ($this->parameters['display'] != '') {
         $loginURL .= '&display=' . $this->parameters['display'];
     }
     if ($this->parameters['immediate']) {
         $loginURL .= '&immediate=true';
     }
     if ($this->parameters['state'] != '') {
         $loginURL .= '&state=' . urlencode($this->parameters['state']);
     }
     if ($this->parameters['scope'] != '') {
         $scope = rawurlencode($this->parameters['scope']);
         $loginURL .= '&scope=' . $scope;
     }
     if ($this->parameters['prompt'] != '') {
         $prompt = rawurlencode($this->parameters['prompt']);
         $loginURL .= '&prompt=' . $prompt;
     }
     return $this->redirect->to($loginURL);
 }
Esempio n. 2
0
 function it_should_authenticate(RedirectInterface $mockedRedirect)
 {
     $mockedRedirect->to(Argument::any())->willReturn('redirectURL');
     $this->authenticate()->shouldReturn('redirectURL');
 }