package auth;
public class OAuth2PasswordAuthentication implements Authentication {
private final String username;
private final String password;
public OAuth2PasswordAuthentication(String username, String password) {
this.username = username;
this.password = password;
}
@Override
public GrantType getGrantType() {
return GrantType.PASSWORD;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
OAuth2PasswordAuthentication that = (OAuth2PasswordAuthentication) o;
if (password != null ? !password.equals(that.password) : that.password != null) {
return false;
}
if (username != null ? !username.equals(that.username) : that.username != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = username != null ? username.hashCode() : 0;
result = 31 * result + (password != null ? password.hashCode() : 0);
return result;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
@Override
public String toString() {
return "OAuth2PasswordAuthentication{" +
"username='" + username + '\'' +
", password='" + password + '\'' +
'}';
}
}