UserProvider
interface UserProvider
Defines the contract for retrieving and validating principals from an underlying data store. A UserProvider isolates all knowledge of how users are stored and looked up, so a guard can authenticate against any backing store (a model, an external service, etc.) through a single interface. Retrieval and credential validation are kept separate: a provider can locate a principal by its credentials without verifying them, and verify a principal's credentials without re-fetching it.
Methods
Retrieves a principal by its unique identifier.
Retrieves a principal matching the given credentials, without verifying them. Implementations should look the principal up by its identifying credential(s) only (e.g. username) and must not treat the password as part of the lookup; verification is the responsibility of validateCredentials().
Verifies that the given credentials are valid for the given principal, typically by checking the supplied password against the principal's stored hash.
Details
at line 22
Principal|null
retrieveById(mixed $id)
Retrieves a principal by its unique identifier.
at line 36
Principal|null
retrieveByCredentials(array $credentials)
Retrieves a principal matching the given credentials, without verifying them. Implementations should look the principal up by its identifying credential(s) only (e.g. username) and must not treat the password as part of the lookup; verification is the responsibility of validateCredentials().
at line 50
bool
validateCredentials(Principal $user, array $credentials)
Verifies that the given credentials are valid for the given principal, typically by checking the supplied password against the principal's stored hash.