resttemplate authorization basic
HttpHeaders createHeaders(String username, String password){ return new HttpHeaders() {{ String auth = username + ":" + password; byte[] encodedAuth = Base64.encodeBase64( auth.getBytes(Charset.forName("US-ASCII")) ); String authHeader = "Basic " + new String( encodedAuth ); set( "Authorization", authHeader ); }};}