Documentation

No matching pages.

API

Config

Facade

Lifecycle

Interface: AuthManagerInterface

Full name: Azera\Security\AuthManagerInterface

Contract for an authentication manager.

The manager is a registry of named guards (e.g. "web" for session-based auth, "api" for token-based auth). It owns the currently active guard and exposes a uniform API for the most common operations.

Concrete guards live in the companion package azera/auth. The framework ships contracts only so applications can be built against the interface without pulling in an implementation.

Public methods

addGuard() ·

public function addGuard(string $name, Azera\Security\GuardInterface $guard): void

Register a guard under a name.

Parameters

Name Type Default Description
$name string - Guard identifier (e.g. "web", "api").
$guard GuardInterface - The guard instance.

Return value

  • Type: void

guard() ·

public function guard(string|null $name = null): Azera\Security\GuardInterface

Set the guard that should be used for subsequent calls.

Parameters

Name Type Default Description
$name string|null null Guard identifier previously registered.

Return value

Throws


currentGuard() ·

public function currentGuard(): Azera\Security\GuardInterface

Get the currently active guard.

Return value


attempt() ·

public function attempt(array $credentials): bool

Attempt to authenticate a set of credentials against the active guard.

Parameters

Name Type Default Description
$credentials array - Credential bag (e.g.
['email' => …, 'password' => …]).

Return value

  • Type: bool
  • Description: True if authentication succeeded.

logout() ·

public function logout(): void

Log the current user out via the active guard.

Return value

  • Type: void

check() ·

public function check(): bool

Check whether a user is currently authenticated via the active guard.

Return value

  • Type: bool

id() ·

public function id(): mixed

Get the authenticated user identifier, or null if not authenticated.

Return value

  • Type: mixed

Back to the Index