git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/Common/authorization-common-library@122438 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3476d4a3d2
commit
fe151091b1
|
@ -84,4 +84,10 @@ public class AuthorizationEntry {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "AuthorizationEntry [clientInfo=" + clientInfo + ", context="
|
||||||
|
+ context + ", map=" + map + ", policies=" + policies + "]";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,24 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public abstract class Policy {
|
public abstract class Policy {
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
|
||||||
protected Policy() {}
|
protected Policy() {}
|
||||||
|
|
||||||
public abstract PolicyType getPolicyType();
|
public abstract PolicyType getPolicyType();
|
||||||
|
|
||||||
public abstract String getPolicyAsString();
|
public abstract String getPolicyAsString();
|
||||||
|
|
||||||
|
public abstract ServiceAccess getServiceAccess();
|
||||||
|
|
||||||
|
public abstract String getContext();
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,10 @@ public class User2ServicePolicy extends Policy {
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ServiceAccess getServiceAccess() {
|
||||||
|
return serviceAccess;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PolicyType getPolicyType() {
|
public PolicyType getPolicyType() {
|
||||||
return PolicyType.USER;
|
return PolicyType.USER;
|
||||||
|
|
|
@ -13,6 +13,11 @@ import javax.xml.bind.annotation.XmlSeeAlso;
|
||||||
@XmlSeeAlso(value={UserInfo.class, ServiceInfo.class})
|
@XmlSeeAlso(value={UserInfo.class, ServiceInfo.class})
|
||||||
public abstract class ClientInfo implements Serializable{
|
public abstract class ClientInfo implements Serializable{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
public abstract String getId();
|
public abstract String getId();
|
||||||
|
|
||||||
public abstract List<String> getRoles();
|
public abstract List<String> getRoles();
|
||||||
|
|
|
@ -1,18 +1,25 @@
|
||||||
package org.gcube.common.authorization.library.provider;
|
package org.gcube.common.authorization.library.provider;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class ServiceIdentifier {
|
public class ServiceIdentifier implements Serializable{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private String serviceClass;
|
private String serviceClass;
|
||||||
private String serviceName;
|
private String serviceName;
|
||||||
private String serviceId;
|
private String serviceId;
|
||||||
|
|
||||||
public ServiceIdentifier() {}
|
protected ServiceIdentifier() {}
|
||||||
|
|
||||||
public ServiceIdentifier(String serviceClass, String serviceName, String serviceId) {
|
public ServiceIdentifier(String serviceClass, String serviceName, String serviceId) {
|
||||||
super();
|
super();
|
||||||
|
@ -34,11 +41,15 @@ public class ServiceIdentifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFullIdentifier(){
|
public String getFullIdentifier(){
|
||||||
return getIdentifier(serviceClass, serviceName, serviceId);
|
return serviceClass+":"+serviceName+":"+serviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getIdentifier(String serviceClass, String serviceName, String serviceId){
|
|
||||||
return serviceClass+":"+serviceName+":"+serviceId;
|
public static ServiceIdentifier getServiceIdentifierFromId(String serviceId){
|
||||||
|
String[] split = serviceId.split(":");
|
||||||
|
if (split.length!=3)
|
||||||
|
throw new IllegalArgumentException("invalid serviceId provided: "+serviceId);
|
||||||
|
return new ServiceIdentifier(split[0], split[1] , split[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,6 +11,10 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class ServiceInfo extends ClientInfo{
|
public class ServiceInfo extends ClientInfo{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
ServiceIdentifier serviceIdentifier;
|
ServiceIdentifier serviceIdentifier;
|
||||||
|
|
||||||
protected ServiceInfo() {}
|
protected ServiceInfo() {}
|
||||||
|
|
|
@ -12,6 +12,11 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
public class UserInfo extends ClientInfo {
|
public class UserInfo extends ClientInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private String clientId;
|
private String clientId;
|
||||||
private List<String> roles = Collections.emptyList();
|
private List<String> roles = Collections.emptyList();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue