Spring 4.0.0 basic authentication with RestTemplate
I am currently working on integration of a third party application with our local reporting system. I would like to implement REST calls with basic authentication but facing issues in Spring 4.0.0. I have a simple solution what works nicely: final RestTemplate restTemplate = new RestTemplate(); final String plainCreds = "username:password"; final byte[] plainCredsBytes = plainCreds.getBytes(); final byte[] base64CredsBytes = Base64.encodeBase64(plainCredsBytes); final String base64Creds = new String(base64CredsBytes); final HttpHeaders headers = new HttpHeaders(); headers.add("Authorization",