stauth/symfony-stauth

Staging server athorization package, .htaccess alternative

0.0.2 2017-07-08 17:08 UTC

This package is not auto-updated.

Last update: 2024-04-28 00:11:07 UTC


README

Latest Stable Version License composer.lock available

Staging server athorization package, alternative for .htaccess, register at stauth.io

Installation

composer require stauth/symfony-stauth

Local and staging

If you don't want Stauth service provider to be exeuted at production environment, import routes in app/routing_dev.yml

# stauth protection
stauth_protection:
    resource: "@StauthProtectionBundle/Resources/config/routing.yml"

Initialize Bundle in AppKernel.php:

        if ($this->getEnvironment() !== 'prod') {
            // ...
            $bundles[] = new Stauth\StauthProtectionBundle();
        }

Production

If you don't mind Stauth service provider being executed at production environment, or you want to protect your production app, import routes in app/routing.yml

# stauth protection
stauth_protection:
    resource: "@StauthProtectionBundle/Resources/config/routing.yml"

Initialize Bundle in AppKernel.php:

    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Stauth\StauthProtectionBundle(),
        );
            

Generate access token at stauth.io and add it to parameteres.yml:

stauth.access_token: 'eyJkkk40eXAiOiJsdvk3k43krKV1QiLCJ...'

By default protected environment is staging, in order to change this, add stauth.protected_env to parameters.yml:

stauth.protected_env: 'local'

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.