public AuthenticatedUser authenticateUser(Credentials credentials)
            throws GuacamoleException {

        // Get the username from the header configured in guacamole.properties
        String username = credentials.getHeader(confService.getHttpAuthHeader());
        if (username != null) {

            // Update credentials with username provided via header for sake of
            // ${GUAC_USERNAME} token
            credentials.setUsername(username);

            AuthenticatedUser authenticatedUser = authenticatedUserProvider.get();
            authenticatedUser.init(username, credentials);
            return authenticatedUser;

        }

        // Authentication not provided via header, yet, so we request it.
        throw new GuacamoleInvalidCredentialsException("Invalid login.", CredentialsInfo.USERNAME_PASSWORD);

    }
Returns an AuthenticatedUser representing the user authenticated by the
given credentials.

@param credentials
    The credentials to use for authentication.

@return
    An AuthenticatedUser representing the user authenticated by the
    given credentials.

@throws GuacamoleException
    If an error occurs while authenticating the user, or if access is
    denied.
extensions/guacamole-auth-header/src/main/java/org/apache/guacamole/auth/header/AuthenticationProviderService.java