Overview

Namespaces

  • Charcoal
    • Object
    • User
      • Acl

Classes

  • AbstractUser
  • Authenticator
  • Authorizer
  • AuthToken
  • AuthTokenMetadata
  • GenericUser

Interfaces

  • UserInterface
  • Overview
  • Namespace
  • Class

Class Authenticator

The Authenticator service helps with user authentication / login.

Constructor dependencies

Constructor dependencies are passed as an array of key=>value pair. The required dependencies are:

  • logger A PSR3 logger instance
  • user_type The user object type (FQN or ident)
  • user_factory The Factory used to instanciate new users.
  • token_type The auth token object type (FQN or ident)
  • token_factory The Factory used to instanciate new auth tokens.
Charcoal\User\Authenticator implements Psr\Log\LoggerAwareInterface uses Psr\Log\LoggerAwareTrait (not available)
Namespace: Charcoal\User
Located at Charcoal/User/Authenticator.php
Methods summary
public
# __construct( array $data )

Returns a new Authoricator object.

Returns a new Authoricator object.

Parameters

$data
Class dependencies.
protected string
# userType( )

Retrieve the user object type.

Retrieve the user object type.

Returns

string
protected Charcoal\Factory\FactoryInterface
# userFactory( )

Retrieve the user model factory.

Retrieve the user model factory.

Returns

Charcoal\Factory\FactoryInterface

Throws

RuntimeException
If the model factory was not previously set.
protected string
# tokenType( )

Retrieve the auth-token object type.

Retrieve the auth-token object type.

Returns

string
protected Charcoal\Factory\FactoryInterface
# tokenFactory( )

Retrieve the auth-token model factory.

Retrieve the auth-token model factory.

Returns

Charcoal\Factory\FactoryInterface

Throws

RuntimeException
If the token factory was not previously set.
public Charcoal\User\UserInterface|null
# authenticate( )

Determine if the current user is authenticated.

Determine if the current user is authenticated.

The user is authenticated via session ID or auth token.

Returns

Charcoal\User\UserInterface|null

Returns the authenticated user object or NULL if not authenticated.

public Charcoal\User\UserInterface|null
# authenticateByPassword( string $username, string $password )

Attempt to authenticate a user using the given credentials.

Attempt to authenticate a user using the given credentials.

Parameters

$username
Username, part of necessery credentials.
$password
Password, part of necessary credentials.

Returns

Charcoal\User\UserInterface|null

Returns the authenticated user object or NULL if not authenticated.

Throws

InvalidArgumentException
If username or password are invalid or empty.
API documentation generated by ApiGen