2017 © Pedro Peláez
 

library ext-auth

MvcCore Extension - Auth - authentication module with automatic authentication module type detection by loaded classes.

image

mvccore/ext-auth

MvcCore Extension - Auth - authentication module with automatic authentication module type detection by loaded classes.

  • Tuesday, June 5, 2018
  • by tomFlidr
  • Repository
  • 1 Watchers
  • 0 Stars
  • 86 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 100 % Grown

The README.md

MvcCore - Extension - Authentication

Latest Stable Version License PHP Version, (*1)

Authentication module with automatic authentication module type detection by loaded classes., (*2)

Installation

composer require mvccore/ext-auth

Usage

Add this to Bootstrap.php or to very application beginning, before application routing., (*3)

\MvcCore\Ext\Auth::GetInstance()
    ->SetPasswordHashSalt('s9E56/QH6!a69sJML9aS$6s+')
    ->SetUserClass('\\MvcCore\\Ext\\Auths\\Users\\SystemConfig');

For system config users, you need to specify users in system.ini like this:, (*4)

[users]
0.userName      = admin
0.fullName      = Administrator
0.passwordHash  = $2y$10$czlFNTYvUUg2IWE2OXNKTO8PB5xPGXz9i8IH7Fa7M0YsPlSLriJZu
; admin password is `demo`

To get sign in form into view in your application controller:, (*5)

...
    public function IndexAction () {
        if ($this->user !== NULL)
            self::Redirect($this->Url('administration_index_page'));
        $this->view->SignInForm = \MvcCore\Ext\Auth::GetInstance()
            ->GetSignInForm()
            ->SetValues(array(// set signed in url to administration index page by default:
                'successUrl' => $this->Url('administration_index_page'),
            ));
    }
...

To get sign out form into view in your application controller:, (*6)

...
    public function PreDispatch () {
        parent::PreDispatch();
        if ($this->viewEnabled && $this->user) {
            $this->view->SignOutForm =\MvcCore\Ext\Auth::GetInstance()
                ->GetSignOutForm()
                ->SetValues(array(
                    'successUrl' => $this->Url('login_page')
                ));
        }
    }
...

For any forms CSRF errors - you can call in base controller Init() action:, (*7)

...
    public function Init() {
        parent::Init();
        // when any CSRF token is outdated or not the same - sign out user by default
        \MvcCore\Ext\Form::AddCsrfErrorHandler(function (\MvcCore\Ext\Form & $form, $errorMsg) {
            \MvcCore\Ext\Auth\User::LogOut();
            self::Redirect($this->Url(
                'Index:Index',
                array('absolute' => TRUE, 'sourceUrl'   => rawurlencode($form->ErrorUrl))
            ));
        });
    }
...

To translate your signin and signout form visible elements, use:, (*8)

\MvcCore\Ext\Auth::GetInstance()->SetTranslator(function ($key, $lang = NULL) {
    // your custom translator model/service:
    return \App\Models\Translator::GetInstance()->Translate($key, $lang);
});

The Versions

05/06 2018

dev-master

9999999-dev

MvcCore Extension - Auth - authentication module with automatic authentication module type detection by loaded classes.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

plugin authentication framework authorization user extension auth mvc login logout authenticate plug-in ext signin signout mvccore sign in sign out log in log out

17/12 2017

v4.3.1

4.3.1.0

MvcCore Extension - Auth - simple authentication service, only to signin/signout an user. Service use credentials defined in system config.ini by default. Service is very easy to extend and configure for new user model class to authenticate the user by any database credentials or anything else and the same is possible for sign in/out controller or form class to use any registration implementation you need.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

plugin authentication framework authorization user extension auth mvc login logout authenticate plug-in ext signin signout mvccore sign in sign out log in log out

07/10 2017

v4.2.0

4.2.0.0

MvcCore Extension - Auth - simple authentication service, only to signin/signout an user. Service use credentials defined in system config.ini by default. Service is very easy to extend and configure for new user model class to authenticate the user by any database credentials or anything else and the same is possible for sign in/out controller or form class to use any registration implementation you need.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

plugin authentication framework authorization user extension auth mvc login logout authenticate plug-in ext signin signout mvccore sign in sign out log in log out

12/05 2017

v4.1.0

4.1.0.0

MvcCore Extension - Auth - simple authentication service, only to signin/signout an user. Service use credentials defined in system config.ini by default. Service is very easy to extend and configure for new user model class to authenticate the user by any database credentials or anything else and the same is possible for sign in/out controller or form class to use any registration implementation you need.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

plugin authentication framework authorization user extension auth mvc login logout authenticate plug-in ext signin signout mvccore sign in sign out log in log out

27/01 2017

v4.0.0

4.0.0.0

MvcCore Extension - Auth - simple authentication service, only to signin/signout an user. Service use credentials defined in system config.ini by default. Service is very easy to extend and configure for new user model class to authenticate the user by any database credentials or anything else and the same is possible for sign in/out controller or form class to use any registration implementation you need.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

plugin authentication framework authorization user extension auth mvc login logout authenticate plug-in ext signin signout mvccore sign in sign out log in log out

26/01 2017

v3.2.0

3.2.0.0

Simple authentication service, only to signin/signout an user. Service use credentials defined in system config.ini by default. Service is very easy to extend and configure for new user model class to authenticate the user by any database credentials or anything else and the same is possible for sign in/out controller or form class to use any registration implementation you need.

  Sources   Download

BSD-3-Clause

The Requires

 

authentication framework authorization user extension auth mvc login logout authenticate ext signin signout mvccore

22/01 2017

v3.1.0

3.1.0.0

Simple authentication service, only to signin/signout an user. Service use credentials defined in system config.ini by default. Service is very easy to extend and configure for new user model class to authenticate the user by any database credentials or anything else and the same is possible for sign in/out controller or form class to use any registration implementation you need.

  Sources   Download

BSD-3-Clause

The Requires

 

authentication framework authorization user extension auth mvc login logout authenticate ext signin signout mvccore

16/01 2017

v3.0.0

3.0.0.0

Simple authentication service, only to signin/signout an user. Service use credentials defined in system config.ini by default. Service is very easy to extend and configure for new user model class to authenticate the user by any database credentials or anything else and the same is possible for sign in/out controller or form class to use any registration implementation you need.

  Sources   Download

BSD-3-Clause

The Requires

 

authentication framework authorization user extension auth mvc login logout authenticate ext signin signout mvccore