From 39d395149c1952b54e2ec71dcdad1e909a3c25ca Mon Sep 17 00:00:00 2001 From: Hergen Dillema Date: Thu, 9 Jul 2020 10:45:08 +0200 Subject: [PATCH] rename project --- changelog.md | 2 +- composer.json | 16 ++++++------- .../{jwtfusionauth.php => jwtauthroles.php} | 0 contributing.md | 2 +- readme.md | 18 +++++++------- .../{jwtfusionauth.php => jwtauthroles.php} | 6 ++--- src/Models/jwk.php | 2 +- src/{jwtfusionauth.php => jwtauthroles.php} | 22 ++++++++--------- ...er.php => jwtauthrolesServiceProvider.php} | 24 +++++++++---------- 9 files changed, 46 insertions(+), 46 deletions(-) rename config/{jwtfusionauth.php => jwtauthroles.php} (100%) rename src/Facades/{jwtfusionauth.php => jwtauthroles.php} (65%) rename src/{jwtfusionauth.php => jwtauthroles.php} (83%) rename src/{jwtfusionauthServiceProvider.php => jwtauthrolesServiceProvider.php} (80%) diff --git a/changelog.md b/changelog.md index da8d518..8c67d2b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ # Changelog -All notable changes to `jwtfusionauth` will be documented in this file. +All notable changes to `jwtauthroles` will be documented in this file. ## Version 1.0 diff --git a/composer.json b/composer.json index 82da5dc..64bc568 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "werk365/jwtfusionauth", - "description": "Use JWT to auth users in Laravel", + "name": "werk365/jwtauthroles", + "description": "Use JWT to auth users and assign roles in Laravel", "version": "1.0.0-alpha", "license": "MIT", "authors": [ @@ -10,8 +10,8 @@ "homepage": "https://365werk/nl" } ], - "homepage": "https://github.com/365werk/jwtfusionauth", - "keywords": ["Laravel", "jwtfusionauth"], + "homepage": "https://github.com/365werk/jwtauthroles", + "keywords": ["Laravel", "jwtauthroles"], "require": { "illuminate/support": "~5|~6|~7", "firebase/php-jwt": "^5.2", @@ -25,21 +25,21 @@ }, "autoload": { "psr-4": { - "werk365\\jwtfusionauth\\": "src/" + "werk365\\jwtauthroles\\": "src/" } }, "autoload-dev": { "psr-4": { - "werk365\\jwtfusionauth\\Tests\\": "tests" + "werk365\\jwtauthroles\\Tests\\": "tests" } }, "extra": { "laravel": { "providers": [ - "werk365\\jwtfusionauth\\jwtfusionauthServiceProvider" + "werk365\\jwtauthroles\\jwtauthrolesServiceProvider" ], "aliases": { - "jwtfusionauth": "werk365\\jwtfusionauth\\Facades\\jwtfusionauth" + "jwtauthroles": "werk365\\jwtauthroles\\Facades\\jwtauthroles" } } } diff --git a/config/jwtfusionauth.php b/config/jwtauthroles.php similarity index 100% rename from config/jwtfusionauth.php rename to config/jwtauthroles.php diff --git a/contributing.md b/contributing.md index b1e0069..1332046 100644 --- a/contributing.md +++ b/contributing.md @@ -2,7 +2,7 @@ Contributions are welcome and will be fully credited. -Contributions are accepted via Pull Requests on [Github](https://github.com/werk365/jwtfusionauth). +Contributions are accepted via Pull Requests on [Github](https://github.com/werk365/jwtauthroles). # Things you could do If you want to contribute but do not know where to start, this list provides some starting points. diff --git a/readme.md b/readme.md index 086f488..7b80a2f 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# jwtfusionauth +# jwtauthroles [![Latest Version on Packagist][ico-version]][link-packagist] [![Total Downloads][ico-downloads]][link-downloads] @@ -12,13 +12,13 @@ Take a look at [contributing.md](contributing.md) to see a to do list. Via Composer ``` bash -$ composer require werk365/jwtfusionauth +$ composer require werk365/jwtauthroles ``` Publish config and migration ```bash -$ php artisan vendor:publish --provider="werk365\jwtfusionauth\jwtfusionauthServiceProvider" +$ php artisan vendor:publish --provider="werk365\jwtauthroles\jwtauthrolesServiceProvider" ``` Run migration @@ -35,7 +35,7 @@ public function boot() $this->registerPolicies(); Auth::viaRequest('jwt', function ($request) { - return jwtfusionauth::authUser($request); + return jwtauthroles::authUser($request); }); } ``` @@ -84,12 +84,12 @@ If you discover any security related issues, please email author email instead o license. Please see the [license file](license.md) for more information. -[ico-version]: https://img.shields.io/packagist/v/werk365/jwtfusionauth.svg?style=flat-square -[ico-downloads]: https://img.shields.io/packagist/dt/werk365/jwtfusionauth.svg?style=flat-square -[ico-travis]: https://img.shields.io/travis/werk365/jwtfusionauth/master.svg?style=flat-square +[ico-version]: https://img.shields.io/packagist/v/werk365/jwtauthroles.svg?style=flat-square +[ico-downloads]: https://img.shields.io/packagist/dt/werk365/jwtauthroles.svg?style=flat-square +[ico-travis]: https://img.shields.io/travis/werk365/jwtauthroles/master.svg?style=flat-square [ico-styleci]: https://styleci.io/repos/12345678/shield -[link-packagist]: https://packagist.org/packages/werk365/jwtfusionauth -[link-downloads]: https://packagist.org/packages/werk365/jwtfusionauth +[link-packagist]: https://packagist.org/packages/werk365/jwtauthroles +[link-downloads]: https://packagist.org/packages/werk365/jwtauthroles [link-author]: https://github.com/HergenD [link-contributors]: ../../contributors diff --git a/src/Facades/jwtfusionauth.php b/src/Facades/jwtauthroles.php similarity index 65% rename from src/Facades/jwtfusionauth.php rename to src/Facades/jwtauthroles.php index f704d7f..53085ad 100644 --- a/src/Facades/jwtfusionauth.php +++ b/src/Facades/jwtauthroles.php @@ -1,10 +1,10 @@ bearerToken(); - $uri = config('jwtfusionauth.useJwk')?config('jwtfusionauth.jwkUri'):config('jwtfusionauth.pemUri'); - $claims = self::verifyToken($jwt, $uri, config('jwtfusionauth.useJwk')); - if(config('jwtfusionauth.autoCreateUser')){ - $user = User::firstOrNew([config('jwtfusionauth.userId') => $claims->sub]); - $user[config('jwtfusionauth.userId')] = $claims->sub; + $uri = config('jwtauthroles.useJwk')?config('jwtauthroles.jwkUri'):config('jwtauthroles.pemUri'); + $claims = self::verifyToken($jwt, $uri, config('jwtauthroles.useJwk')); + if(config('jwtauthroles.autoCreateUser')){ + $user = User::firstOrNew([config('jwtauthroles.userId') => $claims->sub]); + $user[config('jwtauthroles.userId')] = $claims->sub; $user->save(); } else { - $user = User::where(config('jwtfusionauth.userId'), '=' , $claims->sub)->firstOrFail(); + $user = User::where(config('jwtauthroles.userId'), '=' , $claims->sub)->firstOrFail(); } - if(config('jwtfusionauth.usePermissions')){ - if(config('jwtfusionauth.autoCreateRoles')){ + if(config('jwtauthroles.usePermissions')){ + if(config('jwtauthroles.autoCreateRoles')){ foreach($claims->roles as $role){ $db_role = Role::where('name', $role)->first(); if(!$db_role){ diff --git a/src/jwtfusionauthServiceProvider.php b/src/jwtauthrolesServiceProvider.php similarity index 80% rename from src/jwtfusionauthServiceProvider.php rename to src/jwtauthrolesServiceProvider.php index 92ea660..fd260bf 100644 --- a/src/jwtfusionauthServiceProvider.php +++ b/src/jwtauthrolesServiceProvider.php @@ -1,12 +1,12 @@ publishes([ - __DIR__.'/../config/jwtfusionauth.php' => config_path('jwtfusionauth.php'), + __DIR__.'/../config/jwtauthroles.php' => config_path('jwtauthroles.php'), ], 'config'); $this->publishes([ @@ -38,11 +38,11 @@ public function boot(Filesystem $filesystem) */ public function register() { - $this->mergeConfigFrom(__DIR__.'/../config/jwtfusionauth.php', 'jwtfusionauth'); + $this->mergeConfigFrom(__DIR__.'/../config/jwtauthroles.php', 'jwtauthroles'); // Register the service the package provides. - $this->app->singleton('jwtfusionauth', function ($app) { - return new jwtfusionauth; + $this->app->singleton('jwtauthroles', function ($app) { + return new jwtauthroles; }); } @@ -53,7 +53,7 @@ public function register() */ public function provides() { - return ['jwtfusionauth']; + return ['jwtauthroles']; } /** @@ -65,23 +65,23 @@ protected function bootForConsole() { // Publishing the configuration file. $this->publishes([ - __DIR__.'/../config/jwtfusionauth.php' => config_path('jwtfusionauth.php'), - ], 'jwtfusionauth.config'); + __DIR__.'/../config/jwtauthroles.php' => config_path('jwtauthroles.php'), + ], 'jwtauthroles.config'); // Publishing the views. /*$this->publishes([ __DIR__.'/../resources/views' => base_path('resources/views/vendor/werk365'), - ], 'jwtfusionauth.views');*/ + ], 'jwtauthroles.views');*/ // Publishing assets. /*$this->publishes([ __DIR__.'/../resources/assets' => public_path('vendor/werk365'), - ], 'jwtfusionauth.views');*/ + ], 'jwtauthroles.views');*/ // Publishing the translation files. /*$this->publishes([ __DIR__.'/../resources/lang' => resource_path('lang/vendor/werk365'), - ], 'jwtfusionauth.views');*/ + ], 'jwtauthroles.views');*/ // Registering package commands. // $this->commands([]);