Lucio Lelii 2016-09-28 14:00:46 +00:00
parent 69994e0bca
commit 6448cf3b71
5 changed files with 16 additions and 4 deletions

View File

@ -1,5 +1,6 @@
package org.gcube.common.authorization.library;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
@ -20,7 +21,7 @@ public class Policies {
@XmlElementRef(type = Service2ServicePolicy.class),
@XmlElementRef(type = User2ServicePolicy.class),
})
List<Policy> policies;
List<Policy> policies = new ArrayList<Policy>();
@SuppressWarnings("unused")

View File

@ -25,6 +25,9 @@ public final class AuthorizationEndpoint implements Comparable<AuthorizationEndp
@XmlElement
private int port;
@XmlElement(name="secure")
private boolean secureConnection = false;
protected AuthorizationEndpoint() {}
public AuthorizationEndpoint(String infrastructure, int priority, String host, int port) {
@ -62,6 +65,14 @@ public final class AuthorizationEndpoint implements Comparable<AuthorizationEndp
public long getClientCacheValidity() {
return clientCacheValidity;
}
public boolean isSecureConnection() {
return secureConnection;
}
public void setSecureConnection(boolean secureConnection) {
this.secureConnection = secureConnection;
}
@Override
public int compareTo(AuthorizationEndpoint o) {

View File

@ -1 +1 @@
<authorization-endpoint priority="10" infrastructure="gcube"><host>node7.d.d4science.research-infrastructures.eu</host><port>9000</port></authorization-endpoint>
<authorization-endpoint priority="10" infrastructure="gcube"><host>node7.d.d4science.research-infrastructures.eu</host><secure>false</secure><port>9000</port></authorization-endpoint>

View File

@ -30,7 +30,6 @@ public class AuthorizationEntryBinder {
AuthorizationEntry ae1 = new AuthorizationEntry(new UserInfo("lucio.lelii", new ArrayList<String>()), "scope", new ArrayList<Policy>(), "TOKEN");
Map<String, String> services = new HashMap<String, String>();
services.put("service", "endpoint");
//ae1.setMap(new DefaultServiceMap("scope","versione", services ));
context.createMarshaller().marshal(ae1, sw);
System.out.println(sw.toString());
AuthorizationEntry ae2 = (AuthorizationEntry)context.createUnmarshaller().unmarshal(new StringReader(sw.toString()));
@ -43,7 +42,7 @@ public class AuthorizationEntryBinder {
context.createMarshaller().marshal(entries, sw);
System.out.println(sw);
QualifiersList entries2 = (QualifiersList)context.createUnmarshaller().unmarshal(new StringReader(sw.toString()));
//QualifiersList entries2 = (QualifiersList)context.createUnmarshaller().unmarshal(new StringReader(sw.toString()));
}
}

View File

@ -26,6 +26,7 @@ public class EndpointBinder {
JAXBContext context = getContext();
StringWriter sw = new StringWriter();
AuthorizationEndpoint ae1 = new AuthorizationEndpoint("myInfra", 2, "146.48.85.179", 8080);
ae1.setSecureConnection(true);
context.createMarshaller().marshal(ae1, sw);
System.out.println(sw);
AuthorizationEndpoint ae2 = (AuthorizationEndpoint)context.createUnmarshaller().unmarshal(new StringReader(sw.toString()));