PHP Class EasyCorp\Bundle\EasySecurityBundle\Security\Security

Afficher le fichier Open project: easycorp/easy-security-bundle

Méthodes publiques

Méthode Description
__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).

Private Methods

Méthode Description
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().

Method Details

__construct() public méthode

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() public méthode

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
Résultat string

getImpersonatingUser() public méthode

When impersonating a user, it returns the original user who started the impersonation.
public getImpersonatingUser ( ) : mixed
Résultat mixed

getLoginError() public méthode

Returns the error of the last failed login attempt, if any.
public getLoginError ( ) : Symfony\Component\Security\Core\Exception\AuthenticationException | null
Résultat Symfony\Component\Security\Core\Exception\AuthenticationException | null

getLoginUsername() public méthode

Returns the username of the last failed login attempt, if any.
public getLoginUsername ( ) : string | null
Résultat string | null

getUser() public méthode

Returns the current application user.
public getUser ( ) : mixed
Résultat mixed

hasRole() public méthode

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
Résultat boolean

isAnonymous() public méthode

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
Résultat boolean

isAuthenticated() public méthode

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
Résultat boolean

isFullyAuthenticated() public méthode

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
Résultat boolean

isGranted() public méthode

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
Résultat boolean

isPasswordValid() public méthode

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
Résultat boolean

isRemembered() public méthode

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
Résultat boolean

login() public méthode

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
Résultat Symfony\Component\Security\Core\User\UserInterface