diff --git a/smartgears/smartgears/defaults/main.yml b/smartgears/smartgears/defaults/main.yml index 34625d8b..fd04f78a 100644 --- a/smartgears/smartgears/defaults/main.yml +++ b/smartgears/smartgears/defaults/main.yml @@ -48,7 +48,7 @@ smartgears_context: - '/ScalableDataMining' smartgears_scopes: - - '{{ smartgears_infrastructure_name }}' + - '/{{ smartgears_infrastructure_name }}' # The iptables rules use this http_port: '{{ smartgears_http_port }}' diff --git a/smartgears/smartgears/files/TokenGenerator.class b/smartgears/smartgears/files/TokenGenerator.class index 56247ca2..c4577b83 100644 Binary files a/smartgears/smartgears/files/TokenGenerator.class and b/smartgears/smartgears/files/TokenGenerator.class differ diff --git a/smartgears/smartgears/files/TokenGenerator.java b/smartgears/smartgears/files/TokenGenerator.java index 188c92eb..b42f8ed5 100644 --- a/smartgears/smartgears/files/TokenGenerator.java +++ b/smartgears/smartgears/files/TokenGenerator.java @@ -1,44 +1,46 @@ import static org.gcube.common.authorization.client.Constants.authorizationService; - + import java.io.File; import java.io.FileWriter; import java.io.IOException; - + import org.gcube.common.authorization.client.proxy.AuthorizationProxy; import org.gcube.common.authorization.library.provider.ContainerInfo; import org.gcube.common.authorization.library.provider.SecurityTokenProvider; public class TokenGenerator { - //call with parameters : host port filePath adminToken1 ... adminTokenN + //call with parameters : token host port filePath scope1 ... scopeN public static void main(String[] args) { - String host = args[0]; - int port = Integer.parseInt(args[1]); - File file = new File(args[2]); - - + String host = args[0]; + String adminToken = args[1]; + int port = Integer.parseInt(args[2]); + File file = new File(args[3]); + + try { file.createNewFile(); } catch (IOException e1) { System.out.println("error creating file "+file.getAbsolutePath()); e1.printStackTrace(); } - + ContainerInfo containerInfo = new ContainerInfo(host, port); AuthorizationProxy proxy = authorizationService(); try(FileWriter fw = new FileWriter(file)){ - for (int index =3; index"+token+""); } catch (Exception e) { System.out.println("error generating token for context "+args[index]); + e.printStackTrace(); } finally{ - SecurityTokenProvider.instance.reset(); + SecurityTokenProvider.instance.reset(); } } } catch (Exception e) { @@ -49,4 +51,3 @@ public class TokenGenerator { } } - diff --git a/smartgears/smartgears/templates/container.xml.j2 b/smartgears/smartgears/templates/container.xml.j2 index 2f0a5b04..89f13a9a 100644 --- a/smartgears/smartgears/templates/container.xml.j2 +++ b/smartgears/smartgears/templates/container.xml.j2 @@ -2,12 +2,16 @@ {{ smartgears_hostname }} {%if setup_nginx %} - {%if https_port is defined %} + {% if https_port is defined %} {% if http_redirect_to_https is defined and http_redirect_to_https %} {{ https_port }} {% else %} {{ http_port }} {% endif %} + {% else %} + {%if http_port is defined %} + {{ http_port }} + {% endif %} {% endif %} {% else %} {{ item.http_port }}