2015-05-18 19:15:11 +02:00
|
|
|
package org.gcube.common.authorization.library.provider;
|
|
|
|
|
2015-05-29 18:32:49 +02:00
|
|
|
import java.util.List;
|
|
|
|
|
2015-05-18 19:15:11 +02:00
|
|
|
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;
|
2015-05-29 18:32:49 +02:00
|
|
|
private List<String> roles;
|
|
|
|
private List<Service> bannedServices;
|
|
|
|
|
2015-05-18 19:15:11 +02:00
|
|
|
protected UserInfo(){}
|
|
|
|
|
2015-05-29 18:32:49 +02:00
|
|
|
public UserInfo(String userName, List<String> roles, List<Service> bannedServices) {
|
2015-05-18 19:15:11 +02:00
|
|
|
super();
|
|
|
|
this.userName = userName;
|
2015-05-29 18:32:49 +02:00
|
|
|
this.roles = roles;
|
|
|
|
this.bannedServices = bannedServices;
|
2015-05-18 19:15:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getUserName() {
|
|
|
|
return userName;
|
|
|
|
}
|
2015-05-29 18:32:49 +02:00
|
|
|
public List<String> getRoles() {
|
|
|
|
return roles;
|
2015-05-18 19:15:11 +02:00
|
|
|
}
|
|
|
|
|
2015-05-29 18:32:49 +02:00
|
|
|
public List<Service> getBannedServices() {
|
|
|
|
return bannedServices;
|
|
|
|
}
|
|
|
|
|
2015-05-18 19:15:11 +02:00
|
|
|
@Override
|
|
|
|
public int hashCode() {
|
|
|
|
final int prime = 31;
|
|
|
|
int result = 1;
|
2015-05-29 18:32:49 +02:00
|
|
|
result = prime * result + ((roles == null) ? 0 : roles.hashCode());
|
2015-05-18 19:15:11 +02:00
|
|
|
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;
|
2015-05-29 18:32:49 +02:00
|
|
|
if (roles == null) {
|
|
|
|
if (other.roles != null)
|
2015-05-18 19:15:11 +02:00
|
|
|
return false;
|
2015-05-29 18:32:49 +02:00
|
|
|
} else if (!roles.equals(other.roles))
|
2015-05-18 19:15:11 +02:00
|
|
|
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() {
|
2015-05-29 18:32:49 +02:00
|
|
|
return "UserInfo [userName=" + userName + ", roles=" + roles + "]";
|
2015-05-18 19:15:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|