2017 © Pedro Peláez
 

library authentication

Authentication package of the CodeCollab project

image

codecollab/authentication

Authentication package of the CodeCollab project

  • Saturday, July 16, 2016
  • by PeeHaa
  • Repository
  • 1 Watchers
  • 0 Stars
  • 45 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 32 % Grown

The README.md

Authentication

Authentication package of the CodeCollab project, (*1)

Build Status MIT License Latest Stable Version Total Downloads Latest Unstable Version, (*2)

Requirements

PHP7+, (*3)

Installation

Include the library in your project using composer:, (*4)

{
    "require-dev": {
        "codecollab/authentication": "^1"
    }
}

Usage

Creating an instance of User requires an instance of \CodeCollab\Http\Session\Session from the Http Library, (*5)

User Authentication

The logIn function takes as arguments the password from the form, the password hash from the database and the user's information (to be persisted in Session)., (*6)

$user = new User($session);
if ($user->logIn($password_from_form, $hash_from_db, $user_info_from_db)) {
    /** login successful **/
} else {
    /** login failed */
}

Assuming there's a "remember me" feature implemented a user can simply be logged in without comparing password hashes., (*7)

if ($user->logInRememberMe($user_info_from_db)) {
    /** login successful **/
} else {
    /** login failed */
}

After a successful login, the user's information can be retrieved depending on what $user_info_from_db (in above snippet) contained:, (*8)

$user_name = $session->get('user_name');
$user_id = $session->get('user_id');

Login Status

if ($user->isLoggedIn() {
    /** User is logged in **/
}

Password Rehash

To check for and rehash (when needed) a logged in user's password:, (*9)

if ($user->needsRehash($hash_from_db)) {
    $new_hash = $user->rehash($password_from_form);
    //save $new_hash to database
}

Logout

$user->logOut();

Contributing

How to contribute, (*10)

License

MIT, (*11)

Security issues

If you found a security issue please contact directly by mail instead of using the issue tracker at codecollab-security@pieterhordijk.com, (*12)

The Versions

16/07 2016

dev-master

9999999-dev https://github.com/CodeCollab/Authentication

Authentication package of the CodeCollab project

  Sources   Download

See the LICENSE file

The Requires

 

The Development Requires

authentication security codecollab

16/07 2016

1.0.0

1.0.0.0 https://github.com/CodeCollab/Authentication

Authentication package of the CodeCollab project

  Sources   Download

See the LICENSE file

The Requires

 

The Development Requires

authentication security codecollab

31/08 2015

dev-phpunit-unset-bug

dev-phpunit-unset-bug https://github.com/CodeCollab/Authentication

Authentication package of the CodeCollab project

  Sources   Download

See the LICENSE file

The Requires

 

The Development Requires

authentication security codecollab