Ejemplo n.º 1
0
 protected function prepareForTests()
 {
     parent::prepareForTests();
     Route::enableFilters();
     $this->current_realm = Config::get('app.url');
     $user = User::where('identifier', '=', 'sebastian.marcet')->first();
     $this->be($user);
     Session::start();
     $scope = $this->getScopes();
     $this->client_id = 'Jiz87D8/Vcvr6fvQbH4HyNgwTlfSyQ3x.openstack.client';
     $this->client_secret = 'ITc/6Y5N7kOtGKhg';
     $params = array('client_id' => $this->client_id, 'redirect_uri' => 'https://www.test.com/oauth2', 'response_type' => OAuth2Protocol::OAuth2Protocol_ResponseType_Code, 'scope' => implode(' ', $scope), OAuth2Protocol::OAuth2Protocol_AccessType => OAuth2Protocol::OAuth2Protocol_AccessType_Offline);
     Session::set("openid.authorization.response", IAuthService::AuthorizationResponse_AllowOnce);
     $response = $this->action("POST", "OAuth2ProviderController@authorize", $params, array(), array(), array());
     $status = $response->getStatusCode();
     $url = $response->getTargetUrl();
     $content = $response->getContent();
     $comps = @parse_url($url);
     $query = $comps['query'];
     $output = array();
     parse_str($query, $output);
     $params = array('code' => $output['code'], 'redirect_uri' => 'https://www.test.com/oauth2', 'grant_type' => OAuth2Protocol::OAuth2Protocol_GrantType_AuthCode);
     $response = $this->action("POST", "OAuth2ProviderController@token", $params, array(), array(), array("HTTP_Authorization" => " Basic " . base64_encode($this->client_id . ':' . $this->client_secret)));
     $status = $response->getStatusCode();
     $this->assertResponseStatus(200);
     $content = $response->getContent();
     $response = json_decode($content);
     $access_token = $response->access_token;
     $refresh_token = $response->refresh_token;
     $this->access_token = $access_token;
 }
Ejemplo n.º 2
0
 protected function prepareForTests()
 {
     parent::prepareForTests();
     Route::enableFilters();
     $this->current_realm = Config::get('app.url');
     $this->user = User::where('identifier', '=', 'sebastian.marcet')->first();
     $this->be($this->user);
     Session::start();
 }
Ejemplo n.º 3
0
 protected function prepareForTests()
 {
     parent::prepareForTests();
     App::singleton(UtilsServiceCatalog::ServerConfigurationService, 'StubServerConfigurationService');
     //Route::enableFilters();
     $this->current_realm = Config::get('app.url');
     $user = User::where('identifier', '=', 'sebastian.marcet')->first();
     $this->be($user);
     Session::start();
 }