private void validateUsername() throws AuthenticationException {
        if (credentials == null) {
            throw new AuthenticationException("User credentials not set");
        }
        final String username = credentials.getUserName();
        for (int i = 0; i < username.length(); i++) {
            final char ch = username.charAt(i);
            if (Character.isISOControl(ch)) {
                throw new AuthenticationException("Username must not contain any control characters");
            }
            if (ch == ':') {
                throw new AuthenticationException("Username contains a colon character and is invalid");
            }
        }
    }
Constructs a new BasicScheme with UTF-8 as the charset.

@since 4.3
httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/BasicScheme.java