Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- URI baseUri = URI.create("https://my.company.com/");
- String username = "";
- String password = "";
- Authenticator.setDefault(new Authenticator() {
- @Override
- public PasswordAuthentication getPasswordAuthentication() {
- // only return our credentials for our URI
- if (baseUri.getHost().equals(getRequestingHost())) {
- return new PasswordAuthentication(username, password.toCharArray());
- }
- return null;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement