Session
class Session extends Adapter
Session adapter.
Properties
protected UserRepository | $userRepository | User repository. | from Adapter |
protected GroupRepository | $groupRepository | Group repository. | from Adapter |
protected User|null | $user | User entity. | from Adapter |
protected Request | $request | Request instance. | |
protected Response | $response | Response instance. | |
protected Session | $session | Session instance. | |
protected array | $options | Adapter options. | |
protected bool | $hasLoggedOut | Has the user logged out? |
Methods
Creates a new user and returns the user object.
Creates a new group and returns the group object.
Activates a user based on the provided auth token.
Constructor.
Returns the adapter name.
No description
Returns true if the identifier + password combination matches and the user is activated, not locked and not banned.
Sets a remember me cookie.
Logs in a user with a valid identifier/password combination.
Login a user without checking the password.
Returns a basic authentication response if login is required and null if not.
Logs the user out.
Details
in Adapter at line 50
setUserRepository(UserRepositoryInterface $userRepository)
Sets the user repository.
in Adapter at line 24
UserRepository
getUserRepository()
in Adapter at line 66
setGroupRepository(GroupRepositoryInterface $groupRepository)
Sets the group repository.
in Adapter at line 24
GroupRepository
getGroupRepository()
in Adapter at line 82
setUser(UserEntityInterface $user)
Sets the active user.
in Adapter at line 90
bool
isGuest()
Returns true if we don't have an authenticated user and false if we do.
in Adapter at line 98
bool
isLoggedIn()
Returns true if we have an authenticated user and false if we don't.
at line 118
User
createUser(string $email, string $username, string $password, bool $activate = false, array $properties = [])
Creates a new user and returns the user object.
in Adapter at line 133
Group
createGroup(string $name, array $properties = [])
Creates a new group and returns the group object.
in Adapter at line 149
User|bool
activateUser(string $token)
Activates a user based on the provided auth token.
at line 92
__construct(UserRepository $userRepository, GroupRepository $groupRepository, Request $request, Response $response, Session $session, array $options = [])
Constructor.
at line 110
string
getName()
Returns the adapter name.
at line 29
User|null
getUser()
at line 176
protected bool|int
authenticate(string $identifier, string $password, bool $force = false)
Returns true if the identifier + password combination matches and the user is activated, not locked and not banned.
A status code will be retured in all other situations.
at line 225
protected
setRememberMeCookie()
Sets a remember me cookie.
at line 246
bool|int
login(string $identifier, string $password, bool $remember = false, bool $force = false)
Logs in a user with a valid identifier/password combination.
Returns true if the identifier + password combination matches and the user is activated, not locked and not banned. A status code will be retured in all other situations.
at line 283
bool|int
forceLogin(mixed $identifier, bool $remember = false)
Login a user without checking the password.
Returns true if the identifier exists and the user is activated, not locked and not banned. A status code will be retured in all other situations.
at line 294
bool
basicAuth(bool $clearResponse = false)
Returns a basic authentication response if login is required and null if not.
at line 316
logout()
Logs the user out.