Skip to content

InMemoryUserIdentity

A plain value-object PasswordProtectedUserIdentity, returned by every foundation UserProviderInterface implementation (InMemoryUserProvider, PdoUserProvider, CallableUserProvider).

final class InMemoryUserIdentity implements PasswordProtectedUserIdentity

ImplementsPasswordProtectedUserIdentity
Since1.0.0
SourceIdentity/InMemoryUserIdentity.php

public function __construct(string $identifier, string $passwordHash, array<int, string> $roles = []): mixed

Roles/permissions to grant on the SecurityUser.

ParameterTypeDescription
$identifierstringThe stable identifier (e.g. email/username).
$passwordHashstringThe stored password hash.
$rolesarray``<``int``, ``string``>Roles/permissions to grant on the SecurityUser.

Returns mixed

MethodDescription
getIdentifier(): stringThe value UserProviderInterface::loadByIdentifier() was called with (e.g.
getPasswordHash(): string
getRoles(): array<int, string>

public function getIdentifier(): string

The value UserProviderInterface::loadByIdentifier() was called with (e.g.

an email or username) — stable across requests.

Returns string — This identity’s stable identifier.

public function getPasswordHash(): string

Returns string — The stored password hash.

public function getRoles(): array<int, string>

Returns array``<``int``, ``string``> — Roles/permissions to grant on the SecurityUser.