public function checkUserCredentials($username, $password)
    {
        // Load user by username
        try {
            $user = $this->up->loadUserByUsername($username);
        } catch (\Symfony\Component\Security\Core\Exception\UsernameNotFoundException $e) {
            return false;
        }

        // Do extra checks if implementing the AdvancedUserInterface
        if ($user instanceof AdvancedUserInterface) {
            if ($user->isAccountNonExpired() === false) return false;
            if ($user->isAccountNonLocked() === false) return false;
            if ($user->isCredentialsNonExpired() === false) return false;
            if ($user->isEnabled() === false) return false;
        }

        // Check password
        if ($this->encoderFactory->getEncoder($user)->isPasswordValid($user->getPassword(), $password, $user->getSalt())) {
            return true;
        }

        return false;
    }
public function checkUserCredentials($username, $password)
    {
        // Load user by username
        try {
            $user = $this->up->loadUserByUsername($username);
        } catch (\Symfony\Component\Security\Core\Exception\UsernameNotFoundException $e) {
            return false;
        }

        // Do extra checks if implementing the AdvancedUserInterface
        if ($user instanceof AdvancedUserInterface) {
            if ($user->isAccountNonExpired() === false) return false;
            if ($user->isAccountNonLocked() === false) return false;
            if ($user->isCredentialsNonExpired() === false) return false;
            if ($user->isEnabled() === false) return false;
        }

        // Check password
        if ($this->encoderFactory->getEncoder($user)->isPasswordValid($user->getPassword(), $password, $user->getSalt())) {
            return true;
        }

        return false;
    }
public function checkUserCredentials ( $ username , $ password ) { // Load user by username try { $ user = $ this -> up -> loadUserByUsername ( $ username ) ; } catch ( \ Symfony \ Component \ Security \ Core \ Exception \ UsernameNotFoundException $ e ) { return false ; } // Do extra checks if implementing the AdvancedUserInterface if ( $ user instanceof AdvancedUserInterface ) { if ( $ user -> isAccountNonExpired ( ) === false ) return false ; if ( $ user -> isAccountNonLocked ( ) === false ) return false ; if ( $ user -> isCredentialsNonExpired ( ) === false ) return false ; if ( $ user -> isEnabled ( ) === false ) return false ; } // Check password if ( $ this -> encoderFactory -> getEncoder ( $ user ) -> isPasswordValid ( $ user -> getPassword ( ) , $ password , $ user -> getSalt ( ) ) ) { return true ; } return false ; }
Grant access tokens for basic user credentials.

Check the supplied username and password for validity.

You can also use the $client_id param to do any checks required based
on a client, if you need that.

Required for OAuth2::GRANT_TYPE_USER_CREDENTIALS.

@param $username
Username to be check with.
@param $password
Password to be check with.

@return
TRUE if the username and password are valid, and FALSE if it isn't.
Moreover, if the username and password are valid, and you want to

@see http://tools.ietf.org/html/rfc6749#section-4.3

@ingroup oauth2_section_4
Grant access tokens for basic user credentials .