This repository has been archived on 2021-12-05. You can view files and clone it, but cannot push or open issues or pull requests.
envoy/common/src/main/java/envoy/data/LoginCredentials.java

70 lines
2.1 KiB
Java

package envoy.data;
import java.io.Serializable;
/**
* Contains a {@link User}'s login / registration information as well as the
* client version.
* <p>
* Project: <strong>envoy-common</strong><br>
* File: <strong>LoginCredentials.java</strong><br>
* Created: <strong>29.12.2019</strong><br>
*
* @author Kai S. K. Engelbart
* @since Envoy Common v0.2-alpha
*/
public final class LoginCredentials implements Serializable {
private final String identifier, password, clientVersion;
private final boolean registration;
private static final long serialVersionUID = 2;
/**
* Initializes login credentials for a handshake.
*
* @param identifier the identifier of the user
* @param password the password of the user
* @param registration signifies that these credentials are used for user
* registration instead of user login
* @param clientVersion the version of the client sending these credentials
* @since Envoy Common v0.1-beta
*/
public LoginCredentials(String identifier, String password, boolean registration, String clientVersion) {
this.identifier = identifier;
this.password = password;
this.registration = registration;
this.clientVersion = clientVersion;
}
@Override
public String toString() {
return String.format("LoginCredentials[identifier=%s,registration=%b,clientVersion=%s]", identifier, registration, clientVersion);
}
/**
* @return the identifier of the user performing the login
* @since Envoy Common v0.2-alpha
*/
public String getIdentifier() { return identifier; }
/**
* @return the password of the user performing the login
* @since Envoy Common v0.1-beta
*/
public String getPassword() { return password; }
/**
* @return {@code true} if these credentials are used for user registration
* instead of user login
* @since Envoy Common v0.2-alpha
*/
public boolean isRegistration() { return registration; }
/**
* @return the version of the client sending these credentials
* @since Envoy Common v0.1-beta
*/
public String getClientVersion() { return clientVersion; }
}