aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--id/ConfigWebTool/ConfigurationInterface.iml2
-rw-r--r--id/oa/moa-id-oa.iml4
-rw-r--r--id/server/auth/moa-id-auth.iml4
-rw-r--r--id/server/idserverlib/moa-id-lib.iml4
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java99
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java1
-rw-r--r--id/server/proxy/moa-id-proxy.iml4
-rw-r--r--id/templates/moa-id-templates.iml4
-rw-r--r--spss/handbook/clients/api/moa-spss-handbook-apiClient.iml4
-rw-r--r--spss/handbook/clients/moa-spss-handbook-clients.iml2
-rw-r--r--spss/handbook/clients/referencedData/moa-spss-handbook-referencedData.iml2
-rw-r--r--spss/handbook/clients/webservice/moa-spss-handbook-webserviceClient.iml4
-rw-r--r--spss/handbook/moa-spss-handbook.iml2
-rw-r--r--spss/server/moa-spss.iml2
-rw-r--r--spss/server/serverlib/moa-spss-lib.iml4
-rw-r--r--spss/server/serverws/moa-spss-ws.iml4
-rw-r--r--spss/server/tools/moa-spss-tools.iml4
17 files changed, 121 insertions, 29 deletions
diff --git a/id/ConfigWebTool/ConfigurationInterface.iml b/id/ConfigWebTool/ConfigurationInterface.iml
index bb7e047b2..20f45337e 100644
--- a/id/ConfigWebTool/ConfigurationInterface.iml
+++ b/id/ConfigWebTool/ConfigurationInterface.iml
@@ -57,7 +57,7 @@
<orderEntry type="library" name="Maven: iaik.prod:iaik_moa:1.5" level="project" />
<orderEntry type="library" name="Maven: jaxen:jaxen:1.0-FCS" level="project" />
<orderEntry type="library" name="Maven: saxpath:saxpath:1.0-FCS" level="project" />
- <orderEntry type="library" name="Maven: joda-time:joda-time:1.6.2" level="project" />
+ <orderEntry type="library" name="Maven: joda-time:joda-time:2.2" level="project" />
<orderEntry type="library" name="Maven: org.jvnet.hyperjaxb3:hyperjaxb3-ejb-runtime:0.5.6" level="project" />
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: org.jvnet.jaxb2_commons:jaxb2-basics-runtime:0.6.2" level="project" />
diff --git a/id/oa/moa-id-oa.iml b/id/oa/moa-id-oa.iml
index 0b7bf00de..6d9905e25 100644
--- a/id/oa/moa-id-oa.iml
+++ b/id/oa/moa-id-oa.iml
@@ -13,8 +13,8 @@
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/target/classes" />
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <output url="file://$MODULE_DIR$/../target/classes" />
+ <output-test url="file://$MODULE_DIR$/../target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
diff --git a/id/server/auth/moa-id-auth.iml b/id/server/auth/moa-id-auth.iml
index d0aa970fc..f61dfa171 100644
--- a/id/server/auth/moa-id-auth.iml
+++ b/id/server/auth/moa-id-auth.iml
@@ -14,8 +14,8 @@
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/target/classes" />
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <output url="file://$MODULE_DIR$/../../target/classes" />
+ <output-test url="file://$MODULE_DIR$/../../target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
diff --git a/id/server/idserverlib/moa-id-lib.iml b/id/server/idserverlib/moa-id-lib.iml
index 1c04295d7..cf1b34b4b 100644
--- a/id/server/idserverlib/moa-id-lib.iml
+++ b/id/server/idserverlib/moa-id-lib.iml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/target/classes" />
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <output url="file://$MODULE_DIR$/../../target/classes" />
+ <output-test url="file://$MODULE_DIR$/../../target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java
index 7e80273ca..1971fe12d 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AuthenticationRequest.java
@@ -2,9 +2,16 @@ package at.gv.egovernment.moa.id.protocols.stork2;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSession;
import at.gv.egovernment.moa.id.auth.exception.MOAIDException;
+import at.gv.egovernment.moa.id.auth.stork.VelocityProvider;
import at.gv.egovernment.moa.id.moduls.IAction;
import at.gv.egovernment.moa.id.moduls.IRequest;
import at.gv.egovernment.moa.logging.Logger;
+import edu.emory.mathcs.backport.java.util.Collections;
+import eu.stork.peps.auth.commons.*;
+import eu.stork.peps.auth.engine.STORKSAMLEngine;
+import eu.stork.peps.exceptions.STORKSAMLEngineException;
+import org.apache.commons.io.IOUtils;
+import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
@@ -14,12 +21,11 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
+import java.io.*;
+import java.util.ArrayList;
import java.util.HashMap;
import eu.stork.peps.auth.engine.SAMLEngine;
+import sun.rmi.runtime.Log;
/**
* @author bsuzic
@@ -40,6 +46,7 @@ public class AuthenticationRequest implements IAction {
Logger.debug("Starting AuthenticationRequest");
//AuthenticationServer.getInstance().startSTORKAuthentication(httpReq, httpResp, moasession);
Logger.debug("Http Response: " + httpResp.toString() + ", ");
+ Logger.debug("Remote user: " + httpReq.getRemoteAddr());
Logger.debug("Moa session: " + moasession.toString() + " " + moasession.getOAURLRequested() + " " + moasession.getPublicOAURLPrefix() + " " + moasession.getAction() + " " + moasession.getIdentityLink().getName() + " " + moasession.getTarget());
httpResp.reset();
//httpResp.addHeader("Location", "http:/www.google.com");
@@ -82,6 +89,90 @@ public class AuthenticationRequest implements IAction {
//httpResp.setStatus(200);
//VPEPSInboundPostHandler
+ // - prepare attribute list
+ PersonalAttributeList attributeList = new PersonalAttributeList();
+
+ STORKAuthnResponse authnResponse = new STORKAuthnResponse();
+ authnResponse.setCountry("AT");
+
+
+ try {
+
+ IPersonalAttributeList moaAttrList = moasession.getStorkAttributes();
+
+ for (PersonalAttribute personalAttribute : moaAttrList) {
+ Logger.info("Personal attribute found: " + personalAttribute.getName() + personalAttribute.getStatus());
+ if (personalAttribute.getValue().size() > 0) {
+ for (String value : personalAttribute.getValue()) {
+ Logger.info(" Value found: " + value);
+ }
+ }
+ }
+
+ } catch (Exception e) {
+ Logger.error("Exception, attributes: " + e.getMessage());
+ }
+
+ PersonalAttribute newAttribute = new PersonalAttribute();
+ newAttribute.setName("eIdentifier");
+ newAttribute.setValue(new ArrayList<String>(Collections.singletonList("xxxxxxxxxxxxxxx")));
+ attributeList.add(newAttribute);
+ authnResponse.setPersonalAttributeList(attributeList);
+
+
+ try {
+ //Get SAMLEngine instance
+ STORKSAMLEngine engine = STORKSAMLEngine.getInstance("incoming");
+ Logger.debug("Starting generation of SAML response");
+ authnResponse = engine.generateSTORKAuthnResponse(((STORKAuthnRequestDEL)req).getStorkAuthnRequest(),authnResponse,httpReq.getRemoteAddr(),false);
+ //generateSAML Token
+ Logger.info("SAML response succesfully generated!");
+ }catch(STORKSAMLEngineException e){
+ Logger.error("Failed to generate STORK SAML Response", e);
+ throw new MOAIDException("stork.05", null);
+ }
+
+ Logger.info("STORK SAML Response message succesfully generated ");
+ Logger.debug("STORK response: ");
+
+ Logger.debug("authn response string: " + authnResponse.toString());
+
+ String statusCodeValue = authnResponse.getStatusCode();
+ Logger.debug("authn status code value: " + statusCodeValue);
+
+ try {
+ Logger.debug("authn saml:" + IOUtils.toString(authnResponse.getTokenSaml()));
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ try {
+ VelocityEngine velocityEngine = VelocityProvider.getClassPathVelocityEngine();
+ Template template = velocityEngine.getTemplate("/resources/templates/stork2_postbinding_template.html");
+ VelocityContext context = new VelocityContext();
+ //Logger.info("Putting saml token in response: " + org.bouncycastle.util.encoders.Base64.decode(context.get("SAMLResponse").toString()));
+
+ context.put("SAMLResponse", IOUtils.toString(authnResponse.getTokenSaml()));
+ Logger.info("Putting saml token in response: " + org.bouncycastle.util.encoders.Base64.decode(context.get("SAMLResponse").toString()));
+
+ Logger.info("Putting assertion consumer url as action: " + ((STORKAuthnRequestDEL)req).getStorkAuthnRequest().getAssertionConsumerServiceURL());
+ context.put("action", ((STORKAuthnRequestDEL) req).getStorkAuthnRequest().getAssertionConsumerServiceURL());
+ StringWriter writer = new StringWriter();
+ template.merge(context, writer);
+
+ httpResp.getOutputStream().write(writer.toString().getBytes());
+
+ } catch (Exception e) {
+ Logger.error("Velocity error: " + e.getMessage());
+ }
+
+ HttpSession httpSession = httpReq.getSession();
+ httpSession.setAttribute("STORKSessionID", "12345");
+ Logger.info("Status code: " + authnResponse.getStatusCode());
+
+
+
return "12345"; // AssertionId
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java
index 2e42a0d75..9564afa27 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java
@@ -153,6 +153,7 @@ public class STORKProtocol implements IModulInfo, MOAIDAuthConstants {
Logger.error("spi " + authnRequest.getSpInstitution());
+ STORK2Request.setSTORKAuthnRequest(authnRequest);
return STORK2Request;
}
diff --git a/id/server/proxy/moa-id-proxy.iml b/id/server/proxy/moa-id-proxy.iml
index fb1a16d2e..86fa1b292 100644
--- a/id/server/proxy/moa-id-proxy.iml
+++ b/id/server/proxy/moa-id-proxy.iml
@@ -13,8 +13,8 @@
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/target/classes" />
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <output url="file://$MODULE_DIR$/../../target/classes" />
+ <output-test url="file://$MODULE_DIR$/../../target/test-classes" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
diff --git a/id/templates/moa-id-templates.iml b/id/templates/moa-id-templates.iml
index 3b8b05541..0ecf962d0 100644
--- a/id/templates/moa-id-templates.iml
+++ b/id/templates/moa-id-templates.iml
@@ -13,8 +13,8 @@
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/target/classes" />
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <output url="file://$MODULE_DIR$/../target/classes" />
+ <output-test url="file://$MODULE_DIR$/../target/test-classes" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
diff --git a/spss/handbook/clients/api/moa-spss-handbook-apiClient.iml b/spss/handbook/clients/api/moa-spss-handbook-apiClient.iml
index 26b212283..c9c03b243 100644
--- a/spss/handbook/clients/api/moa-spss-handbook-apiClient.iml
+++ b/spss/handbook/clients/api/moa-spss-handbook-apiClient.iml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/target/classes" />
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <output url="file://$MODULE_DIR$/../../../target/classes" />
+ <output-test url="file://$MODULE_DIR$/../../../target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
diff --git a/spss/handbook/clients/moa-spss-handbook-clients.iml b/spss/handbook/clients/moa-spss-handbook-clients.iml
index 04a6248a2..3dda938d9 100644
--- a/spss/handbook/clients/moa-spss-handbook-clients.iml
+++ b/spss/handbook/clients/moa-spss-handbook-clients.iml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
- <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../target/classes" />
<output-test url="file://$MODULE_DIR$/../../target/test-classes" />
<content url="file://$MODULE_DIR$">
diff --git a/spss/handbook/clients/referencedData/moa-spss-handbook-referencedData.iml b/spss/handbook/clients/referencedData/moa-spss-handbook-referencedData.iml
index 29685104a..678776d19 100644
--- a/spss/handbook/clients/referencedData/moa-spss-handbook-referencedData.iml
+++ b/spss/handbook/clients/referencedData/moa-spss-handbook-referencedData.iml
@@ -12,7 +12,7 @@
</configuration>
</facet>
</component>
- <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../../target/classes" />
<output-test url="file://$MODULE_DIR$/../../../target/test-classes" />
<content url="file://$MODULE_DIR$">
diff --git a/spss/handbook/clients/webservice/moa-spss-handbook-webserviceClient.iml b/spss/handbook/clients/webservice/moa-spss-handbook-webserviceClient.iml
index 26b212283..c9c03b243 100644
--- a/spss/handbook/clients/webservice/moa-spss-handbook-webserviceClient.iml
+++ b/spss/handbook/clients/webservice/moa-spss-handbook-webserviceClient.iml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/target/classes" />
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <output url="file://$MODULE_DIR$/../../../target/classes" />
+ <output-test url="file://$MODULE_DIR$/../../../target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
diff --git a/spss/handbook/moa-spss-handbook.iml b/spss/handbook/moa-spss-handbook.iml
index ce921cbeb..deed935ed 100644
--- a/spss/handbook/moa-spss-handbook.iml
+++ b/spss/handbook/moa-spss-handbook.iml
@@ -9,7 +9,7 @@
</configuration>
</facet>
</component>
- <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../target/classes" />
<output-test url="file://$MODULE_DIR$/../target/test-classes" />
<content url="file://$MODULE_DIR$">
diff --git a/spss/server/moa-spss.iml b/spss/server/moa-spss.iml
index 4d170c8a3..567359474 100644
--- a/spss/server/moa-spss.iml
+++ b/spss/server/moa-spss.iml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
- <component name="NewModuleRootManager" inherit-compiler-output="false">
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../target/classes" />
<output-test url="file://$MODULE_DIR$/../target/test-classes" />
<content url="file://$MODULE_DIR$">
diff --git a/spss/server/serverlib/moa-spss-lib.iml b/spss/server/serverlib/moa-spss-lib.iml
index 11dc743a9..7864354f4 100644
--- a/spss/server/serverlib/moa-spss-lib.iml
+++ b/spss/server/serverlib/moa-spss-lib.iml
@@ -45,8 +45,8 @@
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/target/classes" />
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <output url="file://$MODULE_DIR$/../../target/classes" />
+ <output-test url="file://$MODULE_DIR$/../../target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
diff --git a/spss/server/serverws/moa-spss-ws.iml b/spss/server/serverws/moa-spss-ws.iml
index 45ebf8969..60f6d1803 100644
--- a/spss/server/serverws/moa-spss-ws.iml
+++ b/spss/server/serverws/moa-spss-ws.iml
@@ -15,8 +15,8 @@
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/target/classes" />
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <output url="file://$MODULE_DIR$/../../target/classes" />
+ <output-test url="file://$MODULE_DIR$/../../target/test-classes" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
diff --git a/spss/server/tools/moa-spss-tools.iml b/spss/server/tools/moa-spss-tools.iml
index a0c44cf2c..a880f50ab 100644
--- a/spss/server/tools/moa-spss-tools.iml
+++ b/spss/server/tools/moa-spss-tools.iml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
- <output url="file://$MODULE_DIR$/target/classes" />
- <output-test url="file://$MODULE_DIR$/target/test-classes" />
+ <output url="file://$MODULE_DIR$/../../target/classes" />
+ <output-test url="file://$MODULE_DIR$/../../target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />