72 lines
1.4 KiB
Java
72 lines
1.4 KiB
Java
package org.gcube.common.authorization.library.provider;
|
|
|
|
import javax.xml.bind.annotation.XmlAccessType;
|
|
import javax.xml.bind.annotation.XmlAccessorType;
|
|
import javax.xml.bind.annotation.XmlRootElement;
|
|
|
|
|
|
@XmlRootElement
|
|
@XmlAccessorType(XmlAccessType.FIELD)
|
|
public class UserInfo {
|
|
|
|
private String userName;
|
|
private String role;
|
|
|
|
protected UserInfo(){}
|
|
|
|
public UserInfo(String userName, String role) {
|
|
super();
|
|
this.userName = userName;
|
|
this.role = role;
|
|
}
|
|
|
|
public String getUserName() {
|
|
return userName;
|
|
}
|
|
public String getRole() {
|
|
return role;
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
final int prime = 31;
|
|
int result = 1;
|
|
result = prime * result + ((role == null) ? 0 : role.hashCode());
|
|
result = prime * result
|
|
+ ((userName == null) ? 0 : userName.hashCode());
|
|
return result;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object obj) {
|
|
if (this == obj)
|
|
return true;
|
|
if (obj == null)
|
|
return false;
|
|
if (getClass() != obj.getClass())
|
|
return false;
|
|
UserInfo other = (UserInfo) obj;
|
|
if (role == null) {
|
|
if (other.role != null)
|
|
return false;
|
|
} else if (!role.equals(other.role))
|
|
return false;
|
|
if (userName == null) {
|
|
if (other.userName != null)
|
|
return false;
|
|
} else if (!userName.equals(other.userName))
|
|
return false;
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "UserInfo [userName=" + userName + ", role=" + role + "]";
|
|
}
|
|
|
|
|
|
|
|
}
|