class SessionAuthProvider extends AuthProvider implements AuthProviderInterface

Session auth provider.

Properties

protected UserProviderInterface $userProvider User provider from AuthProvider
protected array|null $user Current auth user from AuthProvider
protected array $params Provider params from AuthProvider

Methods

__construct(UserProviderInterface $userProvider, array $params = [])

Constructor

static string|null
readAuthHeader(ServerRequestInterface $request, bool $bearer = true)

Get token from request header

bool
isLogged()

Check if user is logged

void
init()

Init provider

mixed|null
getParam(string $name, mixed $default = null)

Get param

getProvider()

Return user provider

array|null
getUser()

Get current auth user

integer|null
getId()

Gte auth id

void
setProvider(UserProviderInterface $userProvider)

Set user provider

int|null
getLoginAttempts()

Get login attempts

bool
authenticate(array $credentials, ServerRequestInterface|null $request = null)

Auth user

void
logout()

Logout

void
fail()

Fail auth

void
success()

Scucess auth

Details

in AuthProvider at line 49
__construct(UserProviderInterface $userProvider, array $params = [])

Constructor

Parameters

UserProviderInterface $userProvider
array $params

in AuthProvider at line 64
static string|null readAuthHeader(ServerRequestInterface $request, bool $bearer = true)

Get token from request header

Parameters

ServerRequestInterface $request
bool $bearer

Return Value

string|null Api token

in AuthProvider at line 85
bool isLogged()

Check if user is logged

Return Value

bool

in AuthProvider at line 95
protected void init()

Init provider

Return Value

void

in AuthProvider at line 106
mixed|null getParam(string $name, mixed $default = null)

Get param

Parameters

string $name
mixed $default

Return Value

mixed|null

in AuthProvider at line 116
UserProviderInterface getProvider()

Return user provider

Return Value

UserProviderInterface

at line 87
array|null getUser()

Get current auth user

Return Value

array|null

at line 99
integer|null getId()

Gte auth id

Return Value

integer|null

in AuthProvider at line 146
void setProvider(UserProviderInterface $userProvider)

Set user provider

Parameters

UserProviderInterface $userProvider

Return Value

void

at line 109
int|null getLoginAttempts()

Get login attempts

Return Value

int|null

at line 30
bool authenticate(array $credentials, ServerRequestInterface|null $request = null)

Auth user

Parameters

array $credentials
ServerRequestInterface|null $request

Return Value

bool

at line 74
void logout()

Logout

Return Value

void

at line 50
protected void fail()

Fail auth

Return Value

void

at line 62
protected void success()

Scucess auth

Return Value

void