2017 © Pedro Peláez
 

library laravel-stauth

Staging server athorization package, .htaccess alternative

image

stauth/laravel-stauth

Staging server athorization package, .htaccess alternative

  • Thursday, November 9, 2017
  • by lchachurski
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1,233 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Laravel Stauth

Latest Stable Version Total Downloads License composer.lock available, (*1)

Staging server athorization package, alternative for .htaccess, register at stauth.io, (*2)

Installation

composer require stauth/laravel-stauth

Local and staging

If you don't want Stauth service provider to be exeuted at production environment, create StauthProtectionServiceProvider, (*3)

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Stauth\StauthServiceProvider;

class StauthProtectionServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        if ($this->app->environment('local', 'staging')) {
            $this->app->register(StauthServiceProvider::class);
        }
    }
}

And add it to config/app.php below AppServiceProvider:, (*4)


'providers' => [ /** * Stauth app access protection */ App\Providers\StauthProtectionServiceProvider::class, ],

Production

If you don't mind Stauth service provider being executed at production environment, or you want to protect your production env, add it directly at providers array in config/app.php., (*5)


'providers' => [ /** * Staging access control */ Stauth\StauthServiceProvider::class, ],

Add Stauth middleware in app/Http/Kernel.php, it is very important that StauthProtection is above any response cache extension middleware like laravel-responsecache:, (*6)


/** * The application's route middleware groups. * * @var array */ protected $middlewareGroups = [ 'web' => [ ... \Stauth\Middleware\StauthProtection::class, ],

Generate access token at stauth.io and add it as a STAUTH_ACCESS_TOKEN param in .env file:, (*7)

STAUTH_ACCESS_TOKEN=verylongchainoflettersmixedwithsomerandomnumbers123

By default protected environment is staging, in order to change this, add STAUTH_PROTECTED_ENV param in .env file:, (*8)

STAUTH_PROTECTED_ENV=local

Other

If you want to know or do more, read below., (*9)

Publish configuration

You can publish configuration and update required params in php file:, (*10)


php artisan vendor:publish --provider="Stauth\StauthServiceProvider" --tag=config

Cache

Please keep in mind that this package takes adventage of csrf_token, therefore it is important to exclude both routes /stauth/protected and /stauth/authorize from any response caching engines., (*11)

The Versions

09/11 2017

dev-master

9999999-dev

Staging server athorization package, .htaccess alternative

  Sources   Download

MIT

The Requires

 

09/11 2017

0.0.7

0.0.7.0

Staging server athorization package, .htaccess alternative

  Sources   Download

MIT

The Requires

 

21/07 2017
13/06 2017
12/06 2017
24/05 2017
23/05 2017
22/05 2017