
br.com.moip.auth.BasicAuth Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdk-java Show documentation
Show all versions of sdk-java Show documentation
Java SDK for Moip APIs integration
The newest version!
package br.com.moip.auth;
import java.net.HttpURLConnection;
public class BasicAuth implements Authentication {
private final String token;
private final String key;
public BasicAuth(String token, String key) {
this.token = token;
this.key = key;
}
public String getToken() { return token; }
public String getKey() { return key; }
@Override
public void authenticate(HttpURLConnection connection) {
String authorization = Base64.encode((token + ":" + key).getBytes());
connection.setRequestProperty("Authorization", "Basic " + authorization);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy