presto-main/src/main/java/io/prestosql/server/security/PasswordAuthenticator.java/PasswordAuthenticator/authenticate
class PasswordAuthenticator:    @Override
    public Principal authenticate(HttpServletRequest request)
            throws AuthenticationException
    {
        // This handles HTTP basic auth per RFC 7617. The header contains the
        // case-insensitive "Basic" scheme followed by a Base64 encoded "user:pass".
        String header = nullToEmpty(request.getHeader(AUTHORIZATION));

        int space = header.indexOf(' ');
        if ((space < 0) || !header.substring(0, space).equalsIgnoreCase("basic")) {
            throw needAuthentication(null);
        }
        String credentials = decodeCredentials(header.substring(space + 1).trim());

        List<String> parts = Splitter.on(':').limit(2).splitToList(credentials);
        if (parts.size() != 2 || parts.stream().anyMatch(String::isEmpty)) {
            throw new AuthenticationException("Malformed decoded credentials");
        }
        String user = parts.get(0);
        String password = parts.get(1);

        try {
            return authenticatorManager.getAuthenticator().createAuthenticatedPrincipal(user, password);
        }
        catch (AccessDeniedException e) {
            throw needAuthentication(e.getMessage());
        }
        catch (RuntimeException e) {
            throw new RuntimeException("Authentication error", e);
        }
    }