From bcb71edf812c9c41833d5a66c39844ec35466190 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Sun, 26 Apr 2015 12:37:58 +0200 Subject: Fixed basic authentication --- src/CamilStaps/BotleaguesApi/AuthProvider.php | 18 ------------ .../BotleaguesApi/BotleaguesApiServiceProvider.php | 2 +- src/CamilStaps/BotleaguesApi/User.php | 3 +- src/config/auth.php | 34 ---------------------- src/filters.php | 3 -- ...015_02_23_184402_botleaguesapi-create_users.php | 2 +- src/routes.php | 11 +------ 7 files changed, 5 insertions(+), 68 deletions(-) delete mode 100644 src/CamilStaps/BotleaguesApi/AuthProvider.php delete mode 100644 src/config/auth.php (limited to 'src') diff --git a/src/CamilStaps/BotleaguesApi/AuthProvider.php b/src/CamilStaps/BotleaguesApi/AuthProvider.php deleted file mode 100644 index 6cf152d..0000000 --- a/src/CamilStaps/BotleaguesApi/AuthProvider.php +++ /dev/null @@ -1,18 +0,0 @@ - 'camilstaps', 'password' => 'secret'))); // var_dump(Config::get('auth')); diff --git a/src/CamilStaps/BotleaguesApi/User.php b/src/CamilStaps/BotleaguesApi/User.php index f8cf46b..f9db0ee 100644 --- a/src/CamilStaps/BotleaguesApi/User.php +++ b/src/CamilStaps/BotleaguesApi/User.php @@ -5,6 +5,7 @@ use Illuminate\Database\Eloquent\Model; class User extends Model { - protected $hidden = array('password', 'remember_token', 'key'); + protected $table = 'users'; + protected $hidden = array('password', 'remember_token', 'api_key'); } \ No newline at end of file diff --git a/src/config/auth.php b/src/config/auth.php deleted file mode 100644 index ee836e2..0000000 --- a/src/config/auth.php +++ /dev/null @@ -1,34 +0,0 @@ - true, - - /* - |-------------------------------------------------------------------------- - | Authentication Providers - |-------------------------------------------------------------------------- - | - | The authentication providers that should be used when attempting to - | authenticate an incoming API request. - | - */ - - 'auth' => [ - 'custom' => function ($app) { - return new AuthProvider; - }, - ] - -]; diff --git a/src/filters.php b/src/filters.php index 17daa3a..b3d9bbc 100644 --- a/src/filters.php +++ b/src/filters.php @@ -1,4 +1 @@ string('email', 127)->unique(); $table->string('password', 60); $table->rememberToken(); - $table->string('key', 255); + $table->string('api_key', 255); $table->timestamps(); }); } diff --git a/src/routes.php b/src/routes.php index 1ac35ab..f866789 100644 --- a/src/routes.php +++ b/src/routes.php @@ -1,14 +1,5 @@ 'auth.basic', function(){ - return 'hello world'; -}]); - Route::api(['version' => 'v1', 'protected' => true, 'providers' => 'basic'], function () { Route::resource('bot', 'CamilStaps\BotleaguesApi\BotController'); Route::resource('user', 'CamilStaps\BotleaguesApi\UserController'); -}); - -Route::when('bot', 'botleaguesapi-http-auth'); -Route::when('bot/*', 'botleaguesapi-http-auth'); -Route::when('user', 'botleaguesapi-http-auth'); -Route::when('user/*', 'botleaguesapi-http-auth'); \ No newline at end of file +}); \ No newline at end of file -- cgit v1.2.3