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.
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 48
setUserRepository(UserRepositoryInterface $userRepository)
Sets the user repository.
in Adapter at line 22
UserRepository
getUserRepository()
in Adapter at line 64
setGroupRepository(GroupRepositoryInterface $groupRepository)
Sets the group repository.
in Adapter at line 22
GroupRepository
getGroupRepository()
in Adapter at line 80
setUser(UserEntityInterface $user)
Sets the active user.
in Adapter at line 88
bool
isGuest()
Returns TRUE if we don't have an authenticated user and FALSE if we do.
in Adapter at line 96
bool
isLoggedIn()
Returns TRUE if we have an authenticated user and FALSE if we don't.
at line 116
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 131
Group
createGroup(string $name, array $properties = [])
Creates a new group and returns the group object.
in Adapter at line 147
bool
activateUser(string $token)
Activates a user based on the provided action token.
at line 90
__construct(UserRepository $userRepository, GroupRepository $groupRepository, Request $request, Response $response, Session $session, array $options = [])
Constructor.
at line 108
string
getName()
Returns the adapter name.
at line 27
User|null
getUser()
at line 174
protected int|true
authenticate(int|string $identifier, string|null $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 221
protected
setRememberMeCookie()
Sets a remember me cookie.
at line 242
int|true
login(int|string $identifier, string|null $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 279
int|true
forceLogin(int|string $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 290
bool
basicAuth(bool $clearResponse = false)
Returns a basic authentication response if login is required and null if not.
at line 312
logout()
Logs the user out.