Commit 8ccbbc8d authored by frederic motte's avatar frederic motte
Browse files

add logger and add service provisionning

parent 2b683c59
<?xml version="1.0" encoding="UTF-8"?>
<!--
SF-generator - SF-generator Bundle
Copyright (C) 2015 The CHOReVOLUTION project
<!-- SF-generator - SF-generator Bundle Copyright (C) 2015 The CHOReVOLUTION
project This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your option)
any later version. This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details. You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
<modelVersion>4.0.0</modelVersion>
<groupId>eu.chorevolution.transformations.sfgenerator</groupId>
<artifactId>sf-generator</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>CHOReVOLUTION SF-generator - SF-generator Bundle</name>
<packaging>jar</packaging>
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jersey.version>2.21</jersey.version>
<jackson.version>1.9.12</jackson.version>
</properties>
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<organization>
<name>The CHOReVOLUTION project</name>
<url>http://www.chorevolution.eu</url>
</organization>
<licenses>
<license>
<name>GPL v3.0</name>
<url>http://www.gnu.org/licenses/gpl-3.0.en.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<modelVersion>4.0.0</modelVersion>
<groupId>eu.chorevolution.transformations.sfgenerator</groupId>
<artifactId>sf-generator</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>CHOReVOLUTION SF-generator - SF-generator Bundle</name>
<packaging>jar</packaging>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<organization>
<name>The CHOReVOLUTION project</name>
<url>http://www.chorevolution.eu</url>
</organization>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.12</version>
</dependency>
<!-- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.12</version>
</dependency> -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.common</artifactId>
<version>2.11.0-v20150805-0538</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore</artifactId>
<version>2.11.1-v20150805-0538</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore.xmi</artifactId>
<version>2.11.1-v20150805-0538</version>
</dependency>
<dependency>
<groupId>eu.chorevolution.modelingnotations</groupId>
<artifactId>eu.chorevolution.modelingnotations.security</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.ow2.authzforce</groupId>
<artifactId>authzforce-ce-xacml-model</artifactId>
<version>3.4.0</version>
</dependency>
<!-- Jersey -->
<licenses>
<license>
<name>GPL v3.0</name>
<url>http://www.gnu.org/licenses/gpl-3.0.en.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.12</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.12</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.common</artifactId>
<version>2.11.0-v20150805-0538</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore</artifactId>
<version>2.11.1-v20150805-0538</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore.xmi</artifactId>
<version>2.11.1-v20150805-0538</version>
</dependency>
<dependency>
<groupId>eu.chorevolution.modelingnotations</groupId>
<artifactId>eu.chorevolution.modelingnotations.security</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.ow2.authzforce</groupId>
<artifactId>authzforce-ce-xacml-model</artifactId>
<version>3.4.0</version>
</dependency>
</dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.9</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>ow2-snapshots</id>
<url>http://repository.ow2.org/nexus/content/repositories/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>ow2-releases</id>
<url>http://repository.ow2.org/nexus/content/repositories/releases/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<repositories>
<repository>
<id>ow2-snapshots</id>
<url>http://repository.ow2.org/nexus/content/repositories/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>ow2-releases</id>
<url>http://repository.ow2.org/nexus/content/repositories/releases/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<useIncrementalCompilation>false</useIncrementalCompilation>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<compilerArgument>-Xlint:unchecked</compilerArgument>
</configuration>
</plugin>
<!-- Disable default license check and enforce specific -->
<plugin>
<groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<!-- <plugin> <groupId>org.apache.rat</groupId> <artifactId>apache-rat-plugin</artifactId>
<version>0.11</version> <configuration> <excludes> <exclude>**/rat.txt</exclude>
<exclude>**/build-copy-javadoc-files.xml</exclude> <exclude>**/*.log</exclude>
<exclude>.git/**</exclude> <exclude>**/.*</exclude> </excludes> </configuration>
<executions> <execution> <id>rat-check</id> <phase>verify</phase> <goals>
<goal>check</goal> </goals> </execution> </executions> </plugin> -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<useIncrementalCompilation>false</useIncrementalCompilation>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<compilerArgument>-Xlint:unchecked</compilerArgument>
</configuration>
</plugin>
<!-- Disable default license check and enforce specific -->
<plugin>
<groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<!-- <plugin> <groupId>org.apache.rat</groupId> <artifactId>apache-rat-plugin</artifactId>
<version>0.11</version> <configuration> <excludes> <exclude>**/rat.txt</exclude>
<exclude>**/build-copy-javadoc-files.xml</exclude> <exclude>**/*.log</exclude>
<exclude>.git/**</exclude> <exclude>**/.*</exclude> </excludes> </configuration>
<executions> <execution> <id>rat-check</id> <phase>verify</phase> <goals>
<goal>check</goal> </goals> </execution> </executions> </plugin> -->
<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version> <configuration> <configLocation>${basedir}/src/main/resources/checkstyle.xml</configLocation>
<targetJdk>${targetJdk}</targetJdk> </configuration> <executions> <execution>
<id>checkstyle-check</id> <phase>verify</phase> <goals> <goal>check</goal>
</goals> </execution> </executions> </plugin> -->
<!-- Put NOTICE and LICENSE files in all artifacts and javadocs -->
<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId>
<version>2.7</version> <executions> <execution> <id>copy-artifact-legal-files</id>
<phase>process-resources</phase> <goals> <goal>copy-resources</goal> </goals>
<configuration> <outputDirectory>${project.build.directory}/classes/META-INF</outputDirectory>
<resources> <resource> <directory>${basedir}</directory> <includes> <include>LICENSE</include>
<include>NOTICE</include> </includes> </resource> </resources> </configuration>
</execution> <execution> <id>copy-javadoc-legal-files</id> <phase>process-resources</phase>
<goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/apidocs/META-INF</outputDirectory>
<resources> <resource> <directory>${basedir}</directory> <includes> <include>LICENSE</include>
<include>NOTICE</include> </includes> </resource> </resources> </configuration>
</execution> </executions> </plugin> -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<appendAssemblyId>true</appendAssemblyId>
<descriptors>
<descriptor>src/assemble/connector.xml</descriptor>
</descriptors>
<archive>
<index>true</index>
<manifestEntries>
<ConnectorBundle-FrameworkVersion>${project.version}</ConnectorBundle-FrameworkVersion>
<ConnectorBundle-Name>${project.artifactId}</ConnectorBundle-Name>
<ConnectorBundle-Version>${project.version}</ConnectorBundle-Version>
</manifestEntries>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version> <configuration> <configLocation>${basedir}/src/main/resources/checkstyle.xml</configLocation>
<targetJdk>${targetJdk}</targetJdk> </configuration> <executions> <execution>
<id>checkstyle-check</id> <phase>verify</phase> <goals> <goal>check</goal>
</goals> </execution> </executions> </plugin> -->
<!-- Put NOTICE and LICENSE files in all artifacts and javadocs -->
<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId>
<version>2.7</version> <executions> <execution> <id>copy-artifact-legal-files</id>
<phase>process-resources</phase> <goals> <goal>copy-resources</goal> </goals>
<configuration> <outputDirectory>${project.build.directory}/classes/META-INF</outputDirectory>
<resources> <resource> <directory>${basedir}</directory> <includes> <include>LICENSE</include>
<include>NOTICE</include> </includes> </resource> </resources> </configuration>
</execution> <execution> <id>copy-javadoc-legal-files</id> <phase>process-resources</phase>
<goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/apidocs/META-INF</outputDirectory>
<resources> <resource> <directory>${basedir}</directory> <includes> <include>LICENSE</include>
<include>NOTICE</include> </includes> </resource> </resources> </configuration>
</execution> </executions> </plugin> -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<appendAssemblyId>true</appendAssemblyId>
<descriptors>
<descriptor>src/assemble/connector.xml</descriptor>
</descriptors>
<archive>
<index>true</index>
<manifestEntries>
<ConnectorBundle-FrameworkVersion>${project.version}</ConnectorBundle-FrameworkVersion>
<ConnectorBundle-Name>${project.artifactId}</ConnectorBundle-Name>
<ConnectorBundle-Version>${project.version}</ConnectorBundle-Version>
</manifestEntries>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</plugins>
</build>
</project>
\ No newline at end of file
......@@ -17,6 +17,12 @@ import javax.xml.bind.Marshaller;
import org.apache.commons.io.FileUtils;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
//import com.sun.jersey.api.client.Client;
//import com.sun.jersey.api.client.ClientResponse;
//import com.sun.jersey.api.client.WebResource;
import eu.chorevolution.transformations.sfgenerator.SFGeneratorException;
import eu.chorevolution.transformations.sfgenerator.SFType;
......@@ -35,9 +41,44 @@ import eu.chorevolution.transformations.sfgenerator.ConnectionAccount;
import eu.chorevolution.transformations.sfgenerator.LoginPasswordConnectionAccount;
import eu.chorevolution.transformations.sfgenerator.SFGenerator;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
public class SFGeneratorImpl implements SFGenerator {
private static final Logger logger = LoggerFactory.getLogger(SFGeneratorImpl.class);
private void postService(String domain, String ServiceName , String service, String federationServerURL) throws SFGeneratorException{
logger.info("Post service credential with" );
logger.info(" Domain:" + domain );
logger.info(" Service:" + service );
logger.info(" STSUrl:" + federationServerURL );
Client client = Client.create();
WebResource webResource = client
.resource(federationServerURL + "/resources/domains/"+domain+"/services/");
ClientResponse response= webResource.accept("application/json").type("application/json")
.post(ClientResponse.class, service);
logger.info("Post service " + response.getStatus());
logger.info("Post service " + response.getClientResponseStatus());
if (response.getClientResponseStatus().equals(response.getClientResponseStatus().BAD_REQUEST)){
WebResource webResourcePut = client
.resource(federationServerURL + "/resources/domains/"+domain+"/services/"+ ServiceName);
response= webResourcePut.accept("application/json").type("application/json")
.put(ClientResponse.class, service);
logger.info("put service " + response.getStatus());
logger.info("put service " + response.getClientResponseStatus());
}
if (response.getStatus() != 200 && response.getStatus() != 204&& response.getStatus() != 201) {
throw new SFGeneratorException("problem during post user " + service);
}
}
private File generateConfigurationFile(String sfName, String destDir, byte[] securityModel, List<String> groups, ConnectionAccount account, SFType securityFilterType, String domain) throws SFGeneratorException {
private File generateConfigurationFile(String sfName, String destDir, byte[] securityModel, List<String> groups, ConnectionAccount account, SFType securityFilterType, String domain, String STSUrl) throws SFGeneratorException {
......@@ -92,6 +133,19 @@ public class SFGeneratorImpl implements SFGenerator {
e.setGenericAccount(null);
e.setGenericCredential(null);
e.setAuthNElement(null);
// forward the account into the Federation Server
String serviceName = sModel.getSecuritypolicyset().getServiceName();
if (lpAccount!=null)
{
if (lpAccount.getLogin()!=null && lpAccount.getPassword()!=null)
{
String service = "{\"servicename\":\""+serviceName + "\",\"serviceaccount\":\"" + lpAccount.getLogin()+ "\",\"credentialtype\":\"usernametoken\",\"credential\":\""+lpAccount.getPassword()+"\"}";
postService(sModel.getSecuritypolicyset().getDomainName(),serviceName, service, STSUrl);
}
}
}
else{
throw new SFGeneratorException("Authentication mechanism not supported");
......@@ -147,7 +201,7 @@ public class SFGeneratorImpl implements SFGenerator {
destDir = Utilities.getDestinationFolderPath(destDir);
Utilities.deleteProjectFolder(destDir);
File warResultFile = Utilities.copyWarTemplate(destDir);
File configurationFile = generateConfigurationFile(sfName, destDir, securityModel, groups, account, SFType.ADAPTATION, null);
File configurationFile = generateConfigurationFile(sfName, destDir, securityModel, groups, account, SFType.ADAPTATION, null, STSUrl);
Utilities.addConfigFileintoWar(destDir, configurationFile);
File webXml = Utilities.createWebXml(destDir, sf.getName(), STSUrl);
Utilities.addWebXmlFileintoWar(destDir, webXml);
......@@ -175,7 +229,7 @@ public class SFGeneratorImpl implements SFGenerator {
destDir = Utilities.getDestinationFolderPath(destDir);
Utilities.deleteProjectFolder(destDir);
File warResultFile = Utilities.copyWarTemplate(destDir);
File configurationFile = generateConfigurationFile(sfName, destDir, null, groups, null, SFType.PROTECTION, domain);
File configurationFile = generateConfigurationFile(sfName, destDir, null, groups, null, SFType.PROTECTION, domain, STSUrl);
Utilities.addConfigFileintoWar(destDir, configurationFile);
File webXml = Utilities.createWebXml(destDir, sf.getName(), STSUrl);
Utilities.addWebXmlFileintoWar(destDir, webXml);
......@@ -196,27 +250,77 @@ public class SFGeneratorImpl implements SFGenerator {
groups.add("group1");
groups.add("group5");
{
System.out.println("Generation of a SF in front of the choreography");
String SFName = "testProtection";
SFGenerator cdGenerator = new SFGeneratorImpl();
String domain = "domain2";
SF cd = cdGenerator.generateSecurityFilter(SFName,"SF", "http://127.0.0.1:8080/SecurityTokenService", domain , groups);
FileUtils.writeByteArrayToFile(new File( "." + File.separatorChar + SFName + File.separatorChar + "SecurityfilterServletProxy.war"), cd.getWar());
}
{
System.out.println("Generation of a SF in front of a legacy Service. During the service definition, the service owner has provided an account to access it");
String SFName = "testGenAccountWithCred";
Path securityPath = Paths.get("SecModelGenAccountWithCred.security");
byte[] securityModel = Files.readAllBytes(securityPath);
SFGenerator cdGenerator = new SFGeneratorImpl();
SF cd = cdGenerator.generateSecurityFilter(SFName,"SF", "http://127.0.0.1:8080/SecurityTokenService", securityModel, groups, null);
FileUtils.writeByteArrayToFile(new File( "." + File.separatorChar + SFName + File.separatorChar + "SecurityfilterServletProxy.war"), cd.getWar());
}
// {
// System.out.println("Generation of a SF in front of the choreography");
// String SFName = "testProtection";
//
// SFGenerator cdGenerator = new SFGeneratorImpl();
//
// String domain = "domain2";
// SF cd = cdGenerator.generateSecurityFilter(SFName,"SF", "http://127.0.0.1:8080/SecurityTokenService", domain , groups);
// FileUtils.writeByteArrayToFile(new File( "." + File.separatorChar + SFName + File.separatorChar + "SecurityfilterServletProxy.war"), cd.getWar());
// }
//
// {
// System.out.println("Generation of a SF in front of a legacy Service. During the service definition, the service owner has provided an account to access it");
// String SFName = "testGenAccountWithCred";
// Path securityPath = Paths.get("SecModelGenAccountWithCred.security");
// byte[] securityModel = Files.readAllBytes(securityPath);
//
// SFGenerator cdGenerator = new SFGeneratorImpl();
// SF cd = cdGenerator.generateSecurityFilter(SFName,"SF", "http://127.0.0.1:8080/SecurityTokenService", securityModel, groups, null);
// FileUtils.writeByteArrayToFile(new File( "." + File.separatorChar + SFName + File.separatorChar + "SecurityfilterServletProxy.war"), cd.getWar());
// }
//
// {
// System.out.println("Generation of a SF in front of a legacy Service. During the service definition, the service owner has not provided an account to access it. the account must be provided by the designer");
// String SFName = "testGenAccountWithoutCred";
// Path securityPath = Paths.get("SecModelGenAccountWithoutCred.security");
// byte[] securityModel = Files.readAllBytes(securityPath);
//
// SFGenerator cdGenerator = new SFGeneratorImpl();
// LoginPasswordConnectionAccount account = new LoginPasswordConnectionAccount();
// account.setLogin("root");
// account.setPassword("password");
//
// SF cd = cdGenerator.generateSecurityFilter(SFName,"SF", "http://127.0.0.1:8080/SecurityTokenService", securityModel, groups, account);
// FileUtils.writeByteArrayToFile(new File( "." + File.separatorChar + SFName + File.separatorChar + "SecurityfilterServletProxy.war"), cd.getWar());
// }
//
// {
// System.out.println("Generation of a SF in front of a legacy Service. During the service definition, the service owner has required a nominative user account");
// String SFName = "testUserAccount";
// Path securityPath = Paths.get("SecModelUserAccount.security");
// byte[] securityModel = Files.readAllBytes(securityPath);
//
// SFGenerator cdGenerator = new SFGeneratorImpl();
// SF cd = cdGenerator.generateSecurityFilter(SFName,"SF", "http://127.0.0.1:8080/SecurityTokenService", securityModel, groups, null);
// FileUtils.writeByteArrayToFile(new File( "." + File.separatorChar + SFName + File.separatorChar + "SecurityfilterServletProxy.war"), cd.getWar());
// }
//
// {
// System.out.println("Generation of a SF in front of a POI Service.");
// String SFName = "POISF";
// Path securityPath = Paths.get("POIService.security");
// byte[] securityModel = Files.readAllBytes(securityPath);
//
// SFGenerator cdGenerator = new SFGeneratorImpl();
// SF cd = cdGenerator.generateSecurityFilter(SFName,"SF", "http://127.0.0.1:8080/SecurityTokenService", securityModel, groups, null);
// FileUtils.writeByteArrayToFile(new File( "." + File.separatorChar + SFName + File.separatorChar + "SecurityfilterServletProxy.war"), cd.getWar());
// }
//
// {
// System.out.println("Generation of a SF in front of a Traffic Information Service.");
// String SFName = "TrafficInformationSF";
// Path securityPath = Paths.get("TrafficInformationService.security");
// byte[] securityModel = Files.readAllBytes(securityPath);
// LoginPasswordConnectionAccount account = new LoginPasswordConnectionAccount();
// account.setLogin("root");
// account.setPassword("password");
// SFGenerator cdGenerator = new SFGeneratorImpl();
// SF cd = cdGenerator.generateSecurityFilter(SFName,"SF", "http://127.0.0.1:8080/SecurityTokenService", securityModel, groups, account);
// FileUtils.writeByteArrayToFile(new File( "." + File.separatorChar + SFName + File.separatorChar + "SecurityfilterServletProxy.war"), cd.getWar());
// }
{
System.out.println("Generation of a SF in front of a legacy Service. During the service definition, the service owner has not provided an account to access it. the account must be provided by the designer");
......@@ -233,42 +337,8 @@ public class SFGeneratorImpl implements SFGenerator {
FileUtils.writeByteArrayToFile(new File( "." + File.separatorChar + SFName + File.separatorChar + "SecurityfilterServletProxy.war"), cd.getWar());
}
{
System.out.println("Generation of a SF in front of a legacy Service. During the service definition, the service owner has required a nominative user account");
String SFName = "testUserAccount";
Path securityPath = Paths.get("SecModelUserAccount.security");
byte[] securityModel = Files.readAllBytes(securityPath);
SFGenerator cdGenerator = new SFGeneratorImpl();
SF cd = cdGenerator.generateSecurityFilter(SFName,"SF", "http://127.0.0.1:8080/SecurityTokenService", securityModel, groups, null);
FileUtils.writeByteArrayToFile(new File( "." + File.separatorChar + SFName + File.separatorChar + "SecurityfilterServletProxy.war"), cd.getWar());
}
{
System.out.println("Generation of a SF in front of a POI Service.");
String SFName = "POISF";