private function login(ServerRequestInterface $request, &$username)
    {
        //Check header
        $authorization = self::parseAuthorizationHeader($request->getHeaderLine('Authorization'));

        if (!$authorization) {
            return false;
        }

        //Check whether user exists
        if (!isset($this->users[$authorization['username']])) {
            return false;
        }

        $username = $authorization['username'];

        //Check authentication
        return $this->checkAuthentication($authorization, $request->getMethod(), $this->users[$username]);
    }
private function login(ServerRequestInterface $request, &$username)
    {
        //Check header
        $authorization = self::parseAuthorizationHeader($request->getHeaderLine('Authorization'));

        if (!$authorization) {
            return false;
        }

        //Check whether user exists
        if (!isset($this->users[$authorization['username']])) {
            return false;
        }

        $username = $authorization['username'];

        //Check authentication
        return $this->checkAuthentication($authorization, $request->getMethod(), $this->users[$username]);
    }
private function login ( ServerRequestInterface $ request , & $ username ) { //Check header $ authorization = self :: parseAuthorizationHeader ( $ request -> getHeaderLine ( 'Authorization' ) ) ; if ( ! $ authorization ) { return false ; } //Check whether user exists if ( ! isset ( $ this -> users [ $ authorization [ 'username' ] ] ) ) { return false ; } $ username = $ authorization [ 'username' ] ; //Check authentication return $ this -> checkAuthentication ( $ authorization , $ request -> getMethod ( ) , $ this -> users [ $ username ] ) ; }
Login or check the user credentials.

@param ServerRequestInterface $request
@param string|null            $username

@return bool
Login or check the user credentials .