Adding Custom User Providers: The User Provider Contract

<?php

namespace Illuminate\Contracts\Auth;

interface UserProvider {

    public function retrieveById($identifier);
    public function retrieveByToken($identifier, $token);
    public function updateRememberToken(Authenticatable $user, $token);
    public function retrieveByCredentials(array $credentials);
    public function validateCredentials(Authenticatable $user, array $credentials);

}

RetrieveById function

Typically receives a key representing the user, such as an auto-incrementing ID from a MySQL database.

RetrieveByToken function

Retrieves a user by their unique $identifier and "remember me" $token, stored in a field remember_token.

UpdateRememberToken method

Updates the $user field remember_token with the new $token.

RetrieveByCredentials method

Receives the array of credentials passed to the Auth::attempt method when attempting to sign into an application.

ValidateCredentials method

Should compare the given $user with the $credentials to authenticate the user.

Adding Custom User Providers: The User Provider Contract — Structure map

Clickable & Draggable!

Adding Custom User Providers: The User Provider Contract — Related pages: