public static Map<String,String> createBasicAuthHeader(String username,String password,Map<String,String> headerMap){
  if (headerMap == null)   headerMap=new HashMap<>();
  String credentials=username + ":" + password;
  String base64EncodedCredentials=Base64.encodeToString(credentials.getBytes(),Base64.NO_WRAP);
  headerMap.put("Authorization","Basic " + base64EncodedCredentials);
  return headerMap;
}

public static Map < String , String > createBasicAuthHeader ( String username , String password , Map < String , String > headerMap ) { if ( headerMap == null ) headerMap = new HashMap < > ( ) ; String credentials = username + ":" + password ; String base64EncodedCredentials = Base64 . encodeToString ( credentials . getBytes ( ) , Base64 . NO_WRAP ) ; headerMap . put ( "Authorization" , "Basic " + base64EncodedCredentials ) ; return headerMap ; }
method to create a basic http base64 encrypted authentication header
