Advertisement
Guest User

Untitled

a guest
Jun 30th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. URI baseUri = URI.create("https://my.company.com/");
  2. String username = "";
  3. String password = "";
  4.  
  5. Authenticator.setDefault(new Authenticator() {
  6.  
  7. @Override
  8. public PasswordAuthentication getPasswordAuthentication() {
  9. // only return our credentials for our URI
  10. if (baseUri.getHost().equals(getRequestingHost())) {
  11. return new PasswordAuthentication(username, password.toCharArray());
  12. }
  13. return null;
  14. }
  15. });
  16.  
  17. webEngine.setUserAgent("foonAuthorization: Basic YourBase64EncodedCredentials");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement