LoginFormAuthenticator

Extends \Symfony\Component\Security\Guard\Authenticator\AbstractFormLoginAuthenticator

Class LoginFormAuthenticator controller provides Users authentication

package

App\Security

Methods

LoginFormAuthenticator constructor.

__construct(\Doctrine\ORM\EntityManagerInterface $entityManager, \Symfony\Component\Routing\RouterInterface $router, \Symfony\Component\Security\Csrf\CsrfTokenManagerInterface $csrfTokenManager, \Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface $passwordEncoder) 

Arguments

$entityManager

\Doctrine\ORM\EntityManagerInterface

$router

\Symfony\Component\Routing\RouterInterface

$csrfTokenManager

\Symfony\Component\Security\Csrf\CsrfTokenManagerInterface

$passwordEncoder

\Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface

Checks the users authentication credentials

checkCredentials(mixed $credentials, \Symfony\Component\Security\Core\User\UserInterface $user) : boolean

Arguments

$credentials

mixed

$user

\Symfony\Component\Security\Core\User\UserInterface

Response

boolean

Gets the users credentials from the $_SESSION variables

getCredentials(\Symfony\Component\HttpFoundation\Request $request) : array

Arguments

$request

\Symfony\Component\HttpFoundation\Request

Response

array

Returns the security login URL

getLoginUrl() : string

Response

string

Finds the user from the database or returns error of not found

getUser(mixed $credentials, \Symfony\Component\Security\Core\User\UserProviderInterface $userProvider) : \App\Entity\Users|null|object

Arguments

$credentials

mixed

$userProvider

\Symfony\Component\Security\Core\User\UserProviderInterface

Response

\App\Entity\Users|null|object

Redirects the user to designated URL on successful authentication

onAuthenticationSuccess(\Symfony\Component\HttpFoundation\Request $request, \Symfony\Component\Security\Core\Authentication\Token\TokenInterface $token, string $providerKey) : \Symfony\Component\HttpFoundation\RedirectResponse

Arguments

$request

\Symfony\Component\HttpFoundation\Request

$token

\Symfony\Component\Security\Core\Authentication\Token\TokenInterface

$providerKey

string

Response

\Symfony\Component\HttpFoundation\RedirectResponse

Sets the supported type of login methods

supports(\Symfony\Component\HttpFoundation\Request $request) : boolean

Arguments

$request

\Symfony\Component\HttpFoundation\Request

Response

boolean

Properties

Entity Manager Interface to access Users Entity

entityManager : \Doctrine\ORM\EntityManagerInterface
var

Type(s)

\Doctrine\ORM\EntityManagerInterface

Router Interface to redirect and intercept routing requests

router : \Symfony\Component\Routing\RouterInterface
var

Type(s)

\Symfony\Component\Routing\RouterInterface

CSRF Token Manager to support embedded tokens within forms

csrfTokenManager : \Symfony\Component\Security\Csrf\CsrfTokenManagerInterface
var

Type(s)

\Symfony\Component\Security\Csrf\CsrfTokenManagerInterface

Password Encoder interface to support algorithms like bcrypt

passwordEncoder : \Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface
var

Type(s)

\Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface