Esempio n. 1
0
 public function setUp()
 {
     parent::setUp();
     $this->subscription = Mockery::mock('designpond\\newsletter\\Newsletter\\Repo\\NewsletterUserInterface');
     $this->app->instance('designpond\\newsletter\\Newsletter\\Repo\\NewsletterUserInterface', $this->subscription);
     $this->newsletter = Mockery::mock('designpond\\newsletter\\Newsletter\\Repo\\NewsletterInterface');
     $this->app->instance('designpond\\newsletter\\Newsletter\\Repo\\NewsletterInterface', $this->newsletter);
     $this->upload = Mockery::mock('designpond\\newsletter\\Newsletter\\Service\\UploadInterface');
     $this->app->instance('designpond\\newsletter\\Newsletter\\Service\\UploadInterface', $this->upload);
     $this->list = Mockery::mock('designpond\\newsletter\\Newsletter\\Repo\\NewsletterListInterface');
     $this->app->instance('designpond\\newsletter\\Newsletter\\Repo\\NewsletterListInterface', $this->list);
     $this->withFactories(dirname(__DIR__) . '/newsletter/factories');
     $users = \App\Droit\User\Entities\User::all();
     $user = $users->first();
     $this->actingAs($user);
 }
Esempio n. 2
0
    $formParams['client_id'] = $authParams['client']->getId();
    return view('oauth.authorization-form', ['params' => $formParams, 'client' => $authParams['client']]);
}]);
Route::post('oauth/authorize', ['as' => 'oauth.authorize.post', 'middleware' => ['check-authorization-params', 'auth'], function () {
    $params = Authorizer::getAuthCodeRequestParams();
    $params['user_id'] = Auth::user()->id;
    $redirectUri = '';
    // if the user has allowed the client to access its data, redirect back to the client with an auth code
    if (Input::get('approve') !== null) {
        $redirectUri = Authorizer::issueAuthCode('user', $params['user_id'], $params);
    }
    // if the user has denied the client to access its data, redirect back to the client with an error message
    if (Input::get('deny') !== null) {
        $redirectUri = Authorizer::authCodeRequestDeniedRedirectUri();
    }
    return Redirect::to($redirectUri);
}]);
Route::post('oauth/access_token', function () {
    return Response::json(Authorizer::issueAccessToken());
});
Route::get('api/user', ['middleware' => 'oauth', function () {
    $user_id = Authorizer::getResourceOwnerId();
    $user = \App\Droit\User\Entities\User::find($user_id);
    return Response::json(['first_name' => $user->first_name, 'last_name' => $user->last_name, 'email' => $user->email, 'id' => $user_id]);
}]);
/*
 * Only for development
 * */
if (App::environment('local')) {
    require app_path() . '/Http/dev.php';
}
Esempio n. 3
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 public function create(array $data)
 {
     return User::create(['first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }