public function login(String $username, String $password)
    {

        // query whether or not we're already authenticated or not
        if ($this->getAuthType() != null || $this->getRemoteUser() != null || $this->getUserPrincipal() != null) {
            throw new ServletException('Already authenticated');
        }

        // load the authentication manager and try to authenticate this request
        /** @var \AppserverIo\Psr\Auth\AuthenticationManagerInterface $authenticationManager */
        if ($authenticationManager = $this->getAuthenticationManager()) {
            // try to load the authentication managers default authenticator
            if (($authenticator = $authenticationManager->getAuthenticator()) == null) {
                throw new ServletException('Can\'t find default authenticator');
            }

            // authenticate the passed username/password combination
            $authenticator->login($username, $password, $this);
        }
    }
public function login(String $username, String $password)
    {

        // query whether or not we're already authenticated or not
        if ($this->getAuthType() != null || $this->getRemoteUser() != null || $this->getUserPrincipal() != null) {
            throw new ServletException('Already authenticated');
        }

        // load the authentication manager and try to authenticate this request
        /** @var \AppserverIo\Psr\Auth\AuthenticationManagerInterface $authenticationManager */
        if ($authenticationManager = $this->getAuthenticationManager()) {
            // try to load the authentication managers default authenticator
            if (($authenticator = $authenticationManager->getAuthenticator()) == null) {
                throw new ServletException('Can\'t find default authenticator');
            }

            // authenticate the passed username/password combination
            $authenticator->login($username, $password, $this);
        }
    }
public function login ( String $ username , String $ password ) { // query whether or not we're already authenticated or not if ( $ this -> getAuthType ( ) != null || $ this -> getRemoteUser ( ) != null || $ this -> getUserPrincipal ( ) != null ) { throw new ServletException ( 'Already authenticated' ) ; } // load the authentication manager and try to authenticate this request /** @var \AppserverIo\Psr\Auth\AuthenticationManagerInterface $authenticationManager */ if ( $ authenticationManager = $ this -> getAuthenticationManager ( ) ) { // try to load the authentication managers default authenticator if ( ( $ authenticator = $ authenticationManager -> getAuthenticator ( ) ) == null ) { throw new ServletException ( 'Can\'t find default authenticator' ) ; } // authenticate the passed username/password combination $ authenticator -> login ( $ username , $ password , $ this ) ; } }
Validate the provided username and password in the password validation realm used by the web
container login mechanism configured for the ServletContext.

@param \AppserverIo\Lang\String $username The username to login
@param \AppserverIo\Lang\String $password The password used to authenticate the user

@return void
@throws \AppserverIo\Psr\Servlet\ServletException Is thrown if no default authenticator can be found
Validate the provided username and password in the password validation realm used by the web container login mechanism configured for the ServletContext .