Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR BASIC

resttemplate with basic authentication

String plainCreds = "willie:p@ssword";
byte[] plainCredsBytes = plainCreds.getBytes();
byte[] base64CredsBytes = Base64.encodeBase64(plainCredsBytes);
String base64Creds = new String(base64CredsBytes);

HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Basic " + base64Creds);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #resttemplate #basic #authentication
ADD COMMENT
Topic
Name
6+5 =