Neuron-PHP

IAuthenticationService

Authentication Service Interface

Defines the contract for authentication services

Table of Contents

Methods

attempt()  : bool
Attempt to authenticate a user with username and password
check()  : bool
Check if a user is currently authenticated
hasRole()  : bool
Check if user has a specific role
id()  : int|null
Get the currently authenticated user's ID
isAdmin()  : bool
Check if user is admin
isAuthorOrHigher()  : bool
Check if user is author or higher
isEditorOrHigher()  : bool
Check if user is editor or higher
login()  : void
Log a user in (assumes user is already authenticated)
loginUsingRememberToken()  : bool
Attempt login using remember token
logout()  : void
Log the current user out
setLockoutDuration()  : self
Set lockout duration in minutes
setMaxLoginAttempts()  : self
Set maximum login attempts before lockout
user()  : User|null
Get the currently authenticated user
validateCredentials()  : bool
Validate user credentials

Methods

attempt()

Attempt to authenticate a user with username and password

public attempt(string $username, string $password[, bool $remember = false ]) : bool
Parameters
$username : string
$password : string
$remember : bool = false
Return values
bool

True if authentication successful

hasRole()

Check if user has a specific role

public hasRole(string $role) : bool
Parameters
$role : string
Return values
bool

isAuthorOrHigher()

Check if user is author or higher

public isAuthorOrHigher() : bool
Return values
bool

isEditorOrHigher()

Check if user is editor or higher

public isEditorOrHigher() : bool
Return values
bool

login()

Log a user in (assumes user is already authenticated)

public login(User $user[, bool $remember = false ]) : void
Parameters
$user : User
$remember : bool = false

loginUsingRememberToken()

Attempt login using remember token

public loginUsingRememberToken(string $token) : bool
Parameters
$token : string
Return values
bool

setLockoutDuration()

Set lockout duration in minutes

public setLockoutDuration(int $lockoutDuration) : self
Parameters
$lockoutDuration : int
Return values
self

setMaxLoginAttempts()

Set maximum login attempts before lockout

public setMaxLoginAttempts(int $maxLoginAttempts) : self
Parameters
$maxLoginAttempts : int
Return values
self

validateCredentials()

Validate user credentials

public validateCredentials(User $user, string $password) : bool
Parameters
$user : User
$password : string
Return values
bool

        
On this page

Search results