
net.dona.doip.client.PasswordAuthenticationInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of doip-sdk Show documentation
Show all versions of doip-sdk Show documentation
DOIP Software Development Kit that implements DOIP v2 Specification.
package net.dona.doip.client;
import com.google.gson.JsonObject;
/**
* An {@link AuthenticationInfo} which provides a username and a password.
*/
public class PasswordAuthenticationInfo implements AuthenticationInfo {
private final String username;
private final String password;
private final String asUserId;
public PasswordAuthenticationInfo(String username, String password) {
this(username, password, null);
}
public PasswordAuthenticationInfo(String username, String password, String asUserId) {
this.username = username;
this.password = password;
this.asUserId = asUserId;
}
@Override
public String getClientId() {
return null;
}
@Override
public JsonObject getAuthentication() {
JsonObject authentication = new JsonObject();
authentication.addProperty("username", username);
authentication.addProperty("password", password);
if (asUserId != null) {
authentication.addProperty("asUserId", asUserId);
}
return authentication;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy