/** * Creates an interceptor that authenticates all requests with the specified username and password * encoded using the specified charset. * * @param username the username to use for authentication * @param password the password to use for authentication * @param charset the charset to use when encoding the credentials */ public BasicAuthRequestInterceptor(String username, String password, Charset charset) { checkNotNull(username, "username"); checkNotNull(password, "password"); this.headerValue = "Basic " + base64Encode((username + ":" + password).getBytes(charset)); }