2017 © Pedro Peláez
 

windwalker-package authenticate

Windwalker Authenticate package

image

windwalker/authenticate

Windwalker Authenticate package

  • Monday, July 27, 2015
  • by asika32764
  • Repository
  • 3 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 13 Versions
  • 0 % Grown

The README.md

Windwalker Authenticate

Installation via Composer

Add this to the require block in your composer.json., (*1)

``` json { "require": { "windwalker/authenticate": "~2.0" } }, (*2)


## Getting Started This is a simple login auth process. ``` php public function login($username, $password) { $auth = new Authenticate; // Attach methods $auth->addMethod(new LocalMethod); $auth->addMethod(new MyMethod); $credential = new Credential; $credential->username = $username; $credential->password = $password; // Do authenticate $result = $auth->authenticate($credential); // False means login fail if (!$result) { // Print results to know what happened print_r($auth->getResults()); throw new Exception('Username or password not matched'); } $user = $auth->getCredential(); return $user; }

Create Custom Methods

``` php use Windwalker\Authenticate\Method\AbstractMethod;, (*3)

class MyMethod extends AbstractMethod { public function authenticate(Credential $credential) { $username = $credential->username; $password = $credential->password;, (*4)

    if (!$username || !$password)
    {
        $this->status = Authenticate::EMPTY_CREDENTIAL;

        return false;
    }

    $user = Database::loadOne(array('username' => $username));

    if (!$user)
    {
        $this->status = Authenticate::USER_NOT_FOUND;

        return false;
    }

    if (!password_verify($password, $user->password))
    {
        $this->status = Authenticate::INVALID_CREDENTIAL;

        return false;
    }

    // Success
    $this->status = Authenticate::SUCCESS;

    // Set some data to Credential
    $credential->bind($user);

    unset($credential->password);

    return true;
}

} ```, (*5)

The Versions

27/07 2015

dev-master

9999999-dev https://github.com/ventoviro/windwalker-authenticate

Windwalker Authenticate package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework authenticate windwalker

27/07 2015

2.0.9

2.0.9.0 https://github.com/ventoviro/windwalker-authenticate

Windwalker Authenticate package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework authenticate windwalker

16/12 2014

2.0.0

2.0.0.0 https://github.com/ventoviro/windwalker-authenticate

Windwalker Authenticate package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework authenticate windwalker

16/12 2014

2.0.1

2.0.1.0 https://github.com/ventoviro/windwalker-authenticate

Windwalker Authenticate package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework authenticate windwalker

16/12 2014

2.0.2

2.0.2.0 https://github.com/ventoviro/windwalker-authenticate

Windwalker Authenticate package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework authenticate windwalker

16/12 2014

2.0.3

2.0.3.0 https://github.com/ventoviro/windwalker-authenticate

Windwalker Authenticate package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework authenticate windwalker

16/12 2014

2.0.4

2.0.4.0 https://github.com/ventoviro/windwalker-authenticate

Windwalker Authenticate package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework authenticate windwalker

16/12 2014

2.0.5

2.0.5.0 https://github.com/ventoviro/windwalker-authenticate

Windwalker Authenticate package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework authenticate windwalker

16/12 2014

2.0.6

2.0.6.0 https://github.com/ventoviro/windwalker-authenticate

Windwalker Authenticate package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework authenticate windwalker

16/12 2014

2.0.7

2.0.7.0 https://github.com/ventoviro/windwalker-authenticate

Windwalker Authenticate package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework authenticate windwalker

16/12 2014

2.0.8

2.0.8.0 https://github.com/ventoviro/windwalker-authenticate

Windwalker Authenticate package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework authenticate windwalker

16/12 2014

dev-test

dev-test https://github.com/ventoviro/windwalker-authenticate

Windwalker Authenticate package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework authenticate windwalker

24/11 2014

2.0.0-beta2

2.0.0.0-beta2 https://github.com/ventoviro/windwalker-authenticate

Windwalker Authenticate package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework authenticate windwalker