Commit f30444ae authored by frederic motte's avatar frederic motte
Browse files

add simple test for SF generator

parent 0829d37a
...@@ -120,7 +120,8 @@ public class SFGeneratorImpl implements SFGenerator { ...@@ -120,7 +120,8 @@ public class SFGeneratorImpl implements SFGenerator {
byte[] securityModel = Files.readAllBytes(securityPath); byte[] securityModel = Files.readAllBytes(securityPath);
SFGenerator cdGenerator = new SFGeneratorImpl(); SFGenerator cdGenerator = new SFGeneratorImpl();
SF cd = cdGenerator.generateSecurityFilter(SFName,"SF", "http://192.168.150.131:8080/SecurityTokenService/services/securitytokenservice", securityModel, ServiceType.PROSUMER);
SF cd = cdGenerator.generateSecurityFilter(SFName,"SF", "http://127.0.0.1:8080/SecurityTokenService/services/securitytokenservice", securityModel, ServiceType.PROSUMER);
FileUtils.writeByteArrayToFile(new File( "." + File.separatorChar + SFName + File.separatorChar + "SecurityfilterServletProxy.war"), cd.getWar()); FileUtils.writeByteArrayToFile(new File( "." + File.separatorChar + SFName + File.separatorChar + "SecurityfilterServletProxy.war"), cd.getWar());
} }
...@@ -130,7 +131,7 @@ public class SFGeneratorImpl implements SFGenerator { ...@@ -130,7 +131,7 @@ public class SFGeneratorImpl implements SFGenerator {
byte[] securityModel = Files.readAllBytes(securityPath); byte[] securityModel = Files.readAllBytes(securityPath);
SFGenerator cdGenerator = new SFGeneratorImpl(); SFGenerator cdGenerator = new SFGeneratorImpl();
SF cd = cdGenerator.generateSecurityFilter(SFName,"SF", "http://192.168.150.131:8080/SecurityTokenService/services/securitytokenservice", securityModel, ServiceType.PROVIDER); SF cd = cdGenerator.generateSecurityFilter(SFName,"SF", "http://localhost:8080/SecurityTokenService/services/securitytokenservice", securityModel, ServiceType.PROVIDER);
FileUtils.writeByteArrayToFile(new File( "." + File.separatorChar + SFName + File.separatorChar + "SecurityfilterServletProxy.war"), cd.getWar()); FileUtils.writeByteArrayToFile(new File( "." + File.separatorChar + SFName + File.separatorChar + "SecurityfilterServletProxy.war"), cd.getWar());
} }
...@@ -140,7 +141,7 @@ public class SFGeneratorImpl implements SFGenerator { ...@@ -140,7 +141,7 @@ public class SFGeneratorImpl implements SFGenerator {
byte[] securityModel = Files.readAllBytes(securityPath); byte[] securityModel = Files.readAllBytes(securityPath);
SFGenerator cdGenerator = new SFGeneratorImpl(); SFGenerator cdGenerator = new SFGeneratorImpl();
SF cd = cdGenerator.generateSecurityFilter(SFName,"SF", "http://192.168.150.131:8080/SecurityTokenService/services/securitytokenservice", securityModel, ServiceType.PROVIDER); SF cd = cdGenerator.generateSecurityFilter(SFName,"SF", "http://localhost:8080/SecurityTokenService/services/securitytokenservice", securityModel, ServiceType.PROVIDER);
FileUtils.writeByteArrayToFile(new File( "." + File.separatorChar + SFName + File.separatorChar + "SecurityfilterServletProxy.war"), cd.getWar()); FileUtils.writeByteArrayToFile(new File( "." + File.separatorChar + SFName + File.separatorChar + "SecurityfilterServletProxy.war"), cd.getWar());
} }
......
...@@ -2,10 +2,13 @@ package eu.chorevolution; ...@@ -2,10 +2,13 @@ package eu.chorevolution;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBElement;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.frontend.ClientProxyFactoryBean; import org.apache.cxf.frontend.ClientProxyFactoryBean;
import org.apache.cxf.jaxrs.client.WebClient;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import eu.chorevolution.configuration.SecurityPolicy; import eu.chorevolution.configuration.SecurityPolicy;
...@@ -81,8 +84,12 @@ public class UsernameTokenValidator implements Validator { ...@@ -81,8 +84,12 @@ public class UsernameTokenValidator implements Validator {
QName SERVICE_NAME = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/wsdl", "SecurityTokenServiceImplService"); QName SERVICE_NAME = new QName("http://docs.oasis-open.org/ws-sx/ws-trust/200512/wsdl", "SecurityTokenServiceImplService");
Service service = Service.create(wsdlURL, SERVICE_NAME); Service service = Service.create(wsdlURL, SERVICE_NAME);
SecurityTokenService client = service.getPort(SecurityTokenService.class); SecurityTokenService client = service.getPort(SecurityTokenService.class);
ClientProxy.getClient(client).getInInterceptors().add(new LoggingInInterceptor());
ClientProxy.getClient(client).getOutInterceptors().add(new LoggingOutInterceptor());
logger.debug("invoke STS webservice..."); logger.debug("invoke STS webservice...");
RequestSecurityTokenType request = new RequestSecurityTokenType(); RequestSecurityTokenType request = new RequestSecurityTokenType();
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<logger name="eu.chorevolution" level="DEBUG"/> <logger name="eu.chorevolution" level="DEBUG"/>
<root level="ERROR"> <root level="INFO">
<appender-ref ref="FILE" /> <appender-ref ref="FILE" />
</root> </root>
</configuration> </configuration>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment