PHP Класс EasyCorp\Bundle\EasySecurityBundle\Security\Security

Показать файл Открыть проект

Открытые методы

Метод Описание
__construct ( Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface $tokenStorage, Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface $authorizationChecker, Symfony\Component\Security\Core\Encoder\UserPasswordEncoder $passwordEncoder, Symfony\Component\Security\Http\Authentication\AuthenticationUtils $authenticationUtils, Symfony\Component\HttpFoundation\Session\Session $session, Symfony\Component\Security\Core\Role\RoleHierarchy $roleHierarchy )
encodePassword ( string $plainPassword, null $user = null ) : string Returns the given plain password encoded/hashed using the encoder of the current application user or the optionally given user.
getImpersonatingUser ( ) : mixed When impersonating a user, it returns the original user who started the impersonation.
getLoginError ( ) : Symfony\Component\Security\Core\Exception\AuthenticationException | null Returns the error of the last failed login attempt, if any.
getLoginUsername ( ) : string | null Returns the username of the last failed login attempt, if any.
getUser ( ) : mixed Returns the current application user.
hasRole ( $role, null $user = null ) : boolean Returns true if the current application user (or the optionally given user) has the given role. It takes into account the full role hierarchy.
isAnonymous ( null $user = null ) : boolean Returns true if the current application user (or the optionally given user) is anonymous. This behaves differently than Symfony built-in methods and it returns true only when the user is really anonymous.
isAuthenticated ( null $user = null ) : boolean Returns true if the current application user (or the optionally given user) is authenticated in any way (because they have introduced their credentials (username and password) or they have been remembered).
isFullyAuthenticated ( null $user = null ) : boolean Returns true if the current application user (or the optionally given user) is authenticated because they have introduced their credentials (username and password).
isGranted ( mixed $attributes, mixed $object = null ) : boolean Checks if the attributes (usually security roles) are granted for the current application user and the optional given object.
isPasswordValid ( string $plainPassword, null $user = null ) : boolean Returns true if the given plain password is valid for the current application user or the optionally given user.
isRemembered ( null $user = null ) : boolean Returns true if the current application user (or the optionally given user) is remembered. This behaves differently than Symfony built-in methods and it returns true only when the user is really remembered and they haven't introduced their credentials (username and password).
login ( Symfony\Component\Security\Core\User\UserInterface $user, string $firewallName = 'main' ) : Symfony\Component\Security\Core\User\UserInterface It logs in the given user in the 'main' application firewall (or the optionally given firewall name).

Приватные методы

Метод Описание
getUserRolesAsObjects ( Symfony\Component\Security\Core\User\UserInterface $user ) : Symfony\Component\Security\Core\Role\RoleInterface[] Returns an array with the roles of the given user turned into Role objects, which are needed by methods such as getReachableRoles().

Описание методов

__construct() публичный Метод

public __construct ( Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface $tokenStorage, Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface $authorizationChecker, Symfony\Component\Security\Core\Encoder\UserPasswordEncoder $passwordEncoder, Symfony\Component\Security\Http\Authentication\AuthenticationUtils $authenticationUtils, Symfony\Component\HttpFoundation\Session\Session $session, Symfony\Component\Security\Core\Role\RoleHierarchy $roleHierarchy )
$tokenStorage Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface
$authorizationChecker Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface
$passwordEncoder Symfony\Component\Security\Core\Encoder\UserPasswordEncoder
$authenticationUtils Symfony\Component\Security\Http\Authentication\AuthenticationUtils
$session Symfony\Component\HttpFoundation\Session\Session
$roleHierarchy Symfony\Component\Security\Core\Role\RoleHierarchy

encodePassword() публичный Метод

Returns the given plain password encoded/hashed using the encoder of the current application user or the optionally given user.
public encodePassword ( string $plainPassword, null $user = null ) : string
$plainPassword string
$user null
Результат string

getImpersonatingUser() публичный Метод

When impersonating a user, it returns the original user who started the impersonation.
public getImpersonatingUser ( ) : mixed
Результат mixed

getLoginError() публичный Метод

Returns the error of the last failed login attempt, if any.
public getLoginError ( ) : Symfony\Component\Security\Core\Exception\AuthenticationException | null
Результат Symfony\Component\Security\Core\Exception\AuthenticationException | null

getLoginUsername() публичный Метод

Returns the username of the last failed login attempt, if any.
public getLoginUsername ( ) : string | null
Результат string | null

getUser() публичный Метод

Returns the current application user.
public getUser ( ) : mixed
Результат mixed

hasRole() публичный Метод

Returns true if the current application user (or the optionally given user) has the given role. It takes into account the full role hierarchy.
public hasRole ( $role, null $user = null ) : boolean
$role
$user null
Результат boolean

isAnonymous() публичный Метод

Returns true if the current application user (or the optionally given user) is anonymous. This behaves differently than Symfony built-in methods and it returns true only when the user is really anonymous.
public isAnonymous ( null $user = null ) : boolean
$user null
Результат boolean

isAuthenticated() публичный Метод

Returns true if the current application user (or the optionally given user) is authenticated in any way (because they have introduced their credentials (username and password) or they have been remembered).
public isAuthenticated ( null $user = null ) : boolean
$user null
Результат boolean

isFullyAuthenticated() публичный Метод

Returns true if the current application user (or the optionally given user) is authenticated because they have introduced their credentials (username and password).
public isFullyAuthenticated ( null $user = null ) : boolean
$user null
Результат boolean

isGranted() публичный Метод

Checks if the attributes (usually security roles) are granted for the current application user and the optional given object.
public isGranted ( mixed $attributes, mixed $object = null ) : boolean
$attributes mixed
$object mixed
Результат boolean

isPasswordValid() публичный Метод

Returns true if the given plain password is valid for the current application user or the optionally given user.
public isPasswordValid ( string $plainPassword, null $user = null ) : boolean
$plainPassword string
$user null
Результат boolean

isRemembered() публичный Метод

Returns true if the current application user (or the optionally given user) is remembered. This behaves differently than Symfony built-in methods and it returns true only when the user is really remembered and they haven't introduced their credentials (username and password).
public isRemembered ( null $user = null ) : boolean
$user null
Результат boolean

login() публичный Метод

It logs in the given user in the 'main' application firewall (or the optionally given firewall name).
public login ( Symfony\Component\Security\Core\User\UserInterface $user, string $firewallName = 'main' ) : Symfony\Component\Security\Core\User\UserInterface
$user Symfony\Component\Security\Core\User\UserInterface
$firewallName string
Результат Symfony\Component\Security\Core\User\UserInterface