git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/Common/authorization-common-library@131991 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
69994e0bca
commit
6448cf3b71
|
@ -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")
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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>
|
|
@ -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()));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()));
|
||||
|
|
Loading…
Reference in New Issue