Lucio Lelii 2016-11-25 14:11:31 +00:00
parent 2e08673847
commit e428070220
6 changed files with 36 additions and 2 deletions

View File

@ -0,0 +1,6 @@
package org.gcube.common.authorization.library;
public enum ClientType {
USER, SERVICE, EXTERNALSERVICE, CONTAINER
}

View File

@ -8,6 +8,8 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import org.gcube.common.authorization.library.ClientType;
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@XmlSeeAlso(value={UserInfo.class, ServiceInfo.class, ExternalServiceInfo.class, ContainerInfo.class})
@ -22,4 +24,6 @@ public abstract class ClientInfo implements Serializable{
public abstract List<String> getRoles();
public abstract ClientType getType();
}

View File

@ -7,6 +7,8 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.gcube.common.authorization.library.ClientType;
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class ContainerInfo extends ClientInfo{
@ -50,6 +52,9 @@ public class ContainerInfo extends ClientInfo{
return "ContainerInfo [host=" + host + ", port=" + port + "]";
}
@Override
public ClientType getType() {
return ClientType.CONTAINER;
}
}

View File

@ -7,6 +7,8 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.gcube.common.authorization.library.ClientType;
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class ExternalServiceInfo extends ClientInfo{
@ -43,5 +45,9 @@ public class ExternalServiceInfo extends ClientInfo{
public List<String> getRoles() {
return Collections.emptyList();
}
@Override
public ClientType getType() {
return ClientType.EXTERNALSERVICE;
}
}

View File

@ -7,6 +7,8 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.gcube.common.authorization.library.ClientType;
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class ServiceInfo extends ClientInfo{
@ -71,4 +73,8 @@ public class ServiceInfo extends ClientInfo{
return "ServiceInfo [serviceIdentifier=" + serviceIdentifier + "]";
}
@Override
public ClientType getType() {
return ClientType.SERVICE;
}
}

View File

@ -7,6 +7,8 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.gcube.common.authorization.library.ClientType;
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@ -75,5 +77,10 @@ public class UserInfo extends ClientInfo {
public String toString() {
return "UserInfo [clientId=" + clientId + ", roles=" + roles + "]";
}
@Override
public ClientType getType() {
return ClientType.USER;
}
}