aboutsummaryrefslogtreecommitdiff
path: root/id/server/modules/moa-id-modules-saml1
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2016-08-02 14:48:56 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2016-08-02 14:48:56 +0200
commita9b9c5177217de2f99298a416a25f912944d6383 (patch)
tree6556dec0479e3eb21b23eebb3b06a704c4bd4162 /id/server/modules/moa-id-modules-saml1
parentd63a3e5b0ae43808cddd89d62f57868278eb50eb (diff)
downloadmoa-id-spss-a9b9c5177217de2f99298a416a25f912944d6383.tar.gz
moa-id-spss-a9b9c5177217de2f99298a416a25f912944d6383.tar.bz2
moa-id-spss-a9b9c5177217de2f99298a416a25f912944d6383.zip
First untested version of refactor eIDAS module, which uses eIDAS SAMLEngine v1.1 from JoinUp
Diffstat (limited to 'id/server/modules/moa-id-modules-saml1')
-rw-r--r--id/server/modules/moa-id-modules-saml1/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/GetArtifactAction.java18
-rw-r--r--id/server/modules/moa-id-modules-saml1/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/SAML1AuthenticationServer.java77
2 files changed, 45 insertions, 50 deletions
diff --git a/id/server/modules/moa-id-modules-saml1/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/GetArtifactAction.java b/id/server/modules/moa-id-modules-saml1/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/GetArtifactAction.java
index c421bf8cc..d3ebffdfd 100644
--- a/id/server/modules/moa-id-modules-saml1/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/GetArtifactAction.java
+++ b/id/server/modules/moa-id-modules-saml1/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/GetArtifactAction.java
@@ -22,16 +22,12 @@
*******************************************************************************/
package at.gv.egovernment.moa.id.protocols.saml1;
-import java.util.List;
-
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import at.gv.egovernment.moa.id.auth.data.AuthenticationSessionStorageConstants;
-import at.gv.egovernment.moa.id.auth.data.ExtendedSAMLAttribute;
import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
import at.gv.egovernment.moa.id.auth.servlet.RedirectServlet;
import at.gv.egovernment.moa.id.commons.MOAIDAuthConstants;
@@ -43,7 +39,6 @@ import at.gv.egovernment.moa.id.data.SLOInformationInterface;
import at.gv.egovernment.moa.id.moduls.IAction;
import at.gv.egovernment.moa.logging.Logger;
import at.gv.egovernment.moa.util.URLEncoder;
-import eu.eidas.auth.commons.IPersonalAttributeList;
@Service("SAML1_GetArtifactAction")
public class GetArtifactAction implements IAction {
@@ -74,13 +69,16 @@ public class GetArtifactAction implements IAction {
try {
IOAAuthParameters oaParam = req.getOnlineApplicationConfiguration();
+ //TODO: add eIDAS to SAML1 protocol if it is really necessary
+
// add other stork attributes to MOA assertion if available
- IPersonalAttributeList storkAttributes = authData.getGenericData(
- AuthenticationSessionStorageConstants.STORK_ATTRIBUTELIST,
- IPersonalAttributeList.class);
+// IPersonalAttributeList storkAttributes = authData.getGenericData(
+// AuthenticationSessionStorageConstants.STORK_ATTRIBUTELIST,
+// IPersonalAttributeList.class);
+ Object storkAttributes = null;
if(null != storkAttributes) {
- List<ExtendedSAMLAttribute> moaExtendedSAMLAttibutes = saml1server.addAdditionalSTORKAttributes(storkAttributes);
- authData.getExtendedSAMLAttributesOA().addAll(moaExtendedSAMLAttibutes);
+// List<ExtendedSAMLAttribute> moaExtendedSAMLAttibutes = saml1server.addAdditionalSTORKAttributes(storkAttributes);
+// authData.getExtendedSAMLAttributesOA().addAll(moaExtendedSAMLAttibutes);
Logger.info("MOA assertion assembled and SAML Artifact generated.");
}
diff --git a/id/server/modules/moa-id-modules-saml1/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/SAML1AuthenticationServer.java b/id/server/modules/moa-id-modules-saml1/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/SAML1AuthenticationServer.java
index 113fb943f..0a760cb5a 100644
--- a/id/server/modules/moa-id-modules-saml1/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/SAML1AuthenticationServer.java
+++ b/id/server/modules/moa-id-modules-saml1/src/main/java/at/gv/egovernment/moa/id/protocols/saml1/SAML1AuthenticationServer.java
@@ -25,7 +25,6 @@ package at.gv.egovernment.moa.id.protocols.saml1;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
-import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -37,7 +36,6 @@ import javax.xml.namespace.QName;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
-import org.apache.commons.lang3.StringEscapeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.w3c.dom.Element;
@@ -52,7 +50,6 @@ import at.gv.egovernment.moa.id.auth.builder.PersonDataBuilder;
import at.gv.egovernment.moa.id.auth.builder.SAMLArtifactBuilder;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSession;
import at.gv.egovernment.moa.id.auth.data.ExtendedSAMLAttribute;
-import at.gv.egovernment.moa.id.auth.data.ExtendedSAMLAttributeImpl;
import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
import at.gv.egovernment.moa.id.auth.exception.BuildException;
import at.gv.egovernment.moa.id.auth.exception.ParseException;
@@ -82,8 +79,6 @@ import at.gv.util.xsd.persondata.IdentificationType.Value;
import at.gv.util.xsd.persondata.PersonNameType;
import at.gv.util.xsd.persondata.PersonNameType.FamilyName;
import at.gv.util.xsd.persondata.PhysicalPersonType;
-import eu.eidas.auth.commons.IPersonalAttributeList;
-import eu.eidas.auth.commons.PersonalAttribute;
//import at.gv.egovernment.moa.id.util.IdentityLinkReSigner;
@Service("SAML1AuthenticationServer")
@@ -127,41 +122,43 @@ public class SAML1AuthenticationServer extends AuthenticationServer {
return error;
}
- /**
- * Transforms additional STORK attributes to MOA Extended attributes
- * @param iPersonalAttributeList STORK attribute list
- * @return
- */
- public List<ExtendedSAMLAttribute> addAdditionalSTORKAttributes(IPersonalAttributeList iPersonalAttributeList) {
- List<ExtendedSAMLAttribute> moaExtendedSAMLAttributeList = new Vector<ExtendedSAMLAttribute>();
-
- if(null == iPersonalAttributeList)
- return moaExtendedSAMLAttributeList;
-
- Logger.trace("Adding the following attributes to MOA assertion: ");
- int count = 0;
-
- for (PersonalAttribute attribute : iPersonalAttributeList) {
- Object attributeValue = attribute.getValue();
- if (null == attributeValue)
- attributeValue = attribute.getComplexValue();
-
- // escape attributeValue
- attributeValue = StringEscapeUtils.escapeXml10(attributeValue.toString());
- // and remove trailing and tailing brackets. Might break something but we never saw an array with more than one entry!
- attributeValue = ((String) attributeValue).substring(1, ((String) attributeValue).length() - 1);
-
- ExtendedSAMLAttribute extendedSAMLAttribute =
- new ExtendedSAMLAttributeImpl(attribute.getName(), attributeValue, Constants.STORK_NS_URI, 0);
- moaExtendedSAMLAttributeList.add(extendedSAMLAttribute);
- count++;
- Logger.trace("Additional attribute: " + attribute.getName());
- }
-
- Logger.debug("Added " + count + " STORK attribute(s) to the MOA assertion.");
-
- return moaExtendedSAMLAttributeList;
- }
+
+ //TODO: add eIDAS to SAML1 protocol if it is really necessary
+// /**
+// * Transforms additional STORK attributes to MOA Extended attributes
+// * @param iPersonalAttributeList STORK attribute list
+// * @return
+// */
+// public List<ExtendedSAMLAttribute> addAdditionalSTORKAttributes(IPersonalAttributeList iPersonalAttributeList) {
+// List<ExtendedSAMLAttribute> moaExtendedSAMLAttributeList = new Vector<ExtendedSAMLAttribute>();
+//
+// if(null == iPersonalAttributeList)
+// return moaExtendedSAMLAttributeList;
+//
+// Logger.trace("Adding the following attributes to MOA assertion: ");
+// int count = 0;
+//
+// for (PersonalAttribute attribute : iPersonalAttributeList) {
+// Object attributeValue = attribute.getValue();
+// if (null == attributeValue)
+// attributeValue = attribute.getComplexValue();
+//
+// // escape attributeValue
+// attributeValue = StringEscapeUtils.escapeXml10(attributeValue.toString());
+// // and remove trailing and tailing brackets. Might break something but we never saw an array with more than one entry!
+// attributeValue = ((String) attributeValue).substring(1, ((String) attributeValue).length() - 1);
+//
+// ExtendedSAMLAttribute extendedSAMLAttribute =
+// new ExtendedSAMLAttributeImpl(attribute.getName(), attributeValue, Constants.STORK_NS_URI, 0);
+// moaExtendedSAMLAttributeList.add(extendedSAMLAttribute);
+// count++;
+// Logger.trace("Additional attribute: " + attribute.getName());
+// }
+//
+// Logger.debug("Added " + count + " STORK attribute(s) to the MOA assertion.");
+//
+// return moaExtendedSAMLAttributeList;
+// }
/**